Help with Array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jgarcia
Forum Newbie
Posts: 3
Joined: Wed Apr 09, 2003 12:01 pm
Location: São Paulo - Brasil

Help with Array

Post 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
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post 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
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post 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;
jgarcia
Forum Newbie
Posts: 3
Joined: Wed Apr 09, 2003 12:01 pm
Location: São Paulo - Brasil

Post by jgarcia »

Thank you ! I will try this !

Joao Carlos
Post Reply