help me...... string prob...strcat(): ?????????

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Fri Aug 09, 2002 2:25 am

:( ...

i have a var $watever1 ,$waterver2 and $watever3

i wanna make a loop on these var with a counter. like dat i wont have to retype the behavior each time. :wink: ..(lazy guy)

is there any strcat($waterver, $counter); ???
like in the lib <string.h> in C ??????

$counter ll be like $counter ++ at each loop....


hope its clear....

thx all 4 ur help


Fri Aug 09, 2002 2:32 am

Code: Select all

$tempassign = '$localvar = $whatever' . $counter . ';';

if you do this at the start of the loop $localvar will have the value of each of the variables you want to walk through.
"eval" simply executes the code it gets. (

you can do the same at the end of the loop to place some value back in the variable to actualy change it.

although it might be nicer to put those variables in an array when those variables ($whatever1, $whatever2) are created. (if that is possible ofcourse).

Post Reply