|
|
Substring in PHP?
|
|
|
|
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status:
Offline
|
|
Hi,
I was wondering how to do this:
[php]
$big_string = "Hello out there, how are you?"
$substring = substring(0,12,$big_string);
[/php]
so that now substring would have "hello out th". Any advice?
Thanks!
gabe
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2000
Location: Minneapolis, MN
Status:
Offline
|
|
$big_string = "Hello out there, how are you?";
$substring = substr($big_string,0,12);
I believe that's what you want.
Then you can view the result with:
echo $big_string;
echo $substring;
(
Last edited by bluedog; Jun 6, 2003 at 03:14 PM.
)
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Boulder, CO, USA
Status:
Offline
|
|
This and so much more documented at php.net.
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Aug 2002
Location: 127.0.0.1
Status:
Offline
|
|
On PHP.net you just have to type the function you want on the end of the URL, I don`t know if you knew that or not. ( http://php.net/substring )
Also check out this site if you have any more PHP questions Its really good for help.
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status:
Offline
|
|
An absolutely excellent resource is O'Reilly's PHP Cookbook. Buy it. I subscribe to the online Safari version (safari.oreilly.com) and use it all the time.
Not only do you learn how to do something, you learn why to do it that way, why that way is best, and a couple of alternative ways of doing it.
Of course, I also downloaded the PHP documentation, which is a very thorough reference.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|