Jump to content

[SOLVED] Help with variables


d_barszczak

Recommended Posts

simply use

echo $myVar[0];

 

you can access every letter from a string like an array.

 

 

 

edit:

if you still need it in an array:

for ($i = 0; $i < strlen($myVar); $i++){
      $array[] = $myVar[$i];
}

or

for ($i = 0; $i < strlen($myVar); $i++){
      $array[] = substr ($myVar, $i, 1);
}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.