Page 1 of 1

counting the string

Posted: Thu Dec 12, 2002 3:25 pm
by rathlon
2 questions:

1) How do you count characters in a string? Use = count the number of places and use that number to determine the length of a <hr> html element.

2) How do you load the contents of a string into an array? I.e. the following string:

joe was here

I want loaded so that I can address as:
array[0] = 'j'
array[1] = 'o'
array[2] = 'e'
etc...

Posted: Thu Dec 12, 2002 3:35 pm
by Johnm
These functions in a loopshould do the trick, let me know if you have trouble putting it all together.

John M

http://www.php.net/manual/en/function.strlen.php
http://www.php.net/manual/en/function.substr.php