|
|
Short php question
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
I know in JavaScript you have the handy 'charAt()' and 'indexOf()' functions... is there something like that in php? It would help me A LOT.
Thanks.
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by Jaey:
I know in JavaScript you have the handy 'charAt()' and 'indexOf()' functions... is there something like that in php? It would help me A LOT.
Thanks.
$dest = substr ($yourstring, startingat, howmanychars);
e.g.
$name = "Simon Mundy"
$name = substr($name,0,5);
echo $name;
prints "Simon";
Spend some time at www.php.net reading and re-reading the documentation if you get the chance - every time I visit I still learn something new, or find a better way to do things.
|
Computer thez nohhh...
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Ooh, that helps, thanks. That would take care of the charAt().
After reading some php.net documentation, I found that strpos would take care of the indexOf(). Thanks for that tip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|