counting the string

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
rathlon
Forum Commoner
Posts: 45
Joined: Sun Nov 10, 2002 8:07 pm

counting the string

Post 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...
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post 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
Post Reply