Autor Beitrag
elimhren
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21


D6 Prof
BeitragVerfasst: Mo 14.07.03 20:02 
Hi Leute!
Gibts ne einfachere (ohne schleife) Möglichkeit den letzten beschriebenen Datensatz zu bekommen als so? damit ich nen neuen hinten dran hängen kann

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
for i:=low(meinarray) to high(meinarray) do 
 if meinarray[i]='' then 
 begin
  neueid := i+1
  break; 
 end;

meinarray[neueid]:='wasauchimmer';


in php ginge das auf
ausblenden Quelltext
1:
meinarray[] = "wasauchimmer";					

danke!
jo
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Mo 14.07.03 20:18 
PHP benutzt dafür auch dynamische Arrays. Wenn du unter Delphi natürlich statische Arrays benutzt brauchst du entweder eine Schleife oder eine Variable, die du ständig erhöhst.

_________________
Ist Zeit wirklich Geld?
elimhren Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21


D6 Prof
BeitragVerfasst: Di 15.07.03 10:57 
und für dynamische, hau ich die variable vorher in setlength rein oder?

bsp.:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var zaehler : integer; // irgendwo 0 initialisiert
var meinarray : array of string;


procedure macharrayeintrag(eintrag:string);
begin
 setlength(meinarray,zaehler);
 meinarray(zaehler) := eintrag;
 inc(zaehler); 
end;