Page 1 of 1

Help with Array

Posted: Wed Apr 09, 2003 4:19 pm
by jgarcia
Hi,

I have a varible called $LINHA[1] ( [1] is the index ) with the value "12345", but I have to access byte-to-byte, that is, "1" than "2", and so far.

How can I do this ?

I've ever tried the function array and settype ...


TIA

Joao Carlos

Posted: Wed Apr 09, 2003 5:58 pm
by bionicdonkey
play around with substr
you could use it in a loop with strlen to get the length
lookup the syntax in the php manual

Posted: Wed Apr 09, 2003 9:10 pm
by hob_goblin
strlen(), substr(), and a for() loop.

Code: Select all

for($i = 0; $i < strlen($string); $i++)&#123;
$singlecharacter = subtr($string, $i, 1);
&#125;

Posted: Thu Apr 10, 2003 1:48 pm
by jgarcia
Thank you ! I will try this !

Joao Carlos