split a string after 50 characters

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
User avatar
w35z0r
Forum Newbie
Posts: 17
Joined: Thu May 18, 2006 7:02 pm

split a string after 50 characters

Post by w35z0r »

I'm currently trying to split a string after a certain number of characters (say, 50). Basically, I want $bigString to turn into $firstFifty and $everythingElse.

I'm doing this for a article displayer. The idea is that it displays the first 50 characters of the article and a [...] at the end of that. I have a javascript function that activates when the [...] is clicked so that the rest of the article is displayed.

Thanks much for your time.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: split a string after 50 characters

Post by onion2k »

Use substr().
User avatar
w35z0r
Forum Newbie
Posts: 17
Joined: Thu May 18, 2006 7:02 pm

Re: split a string after 50 characters

Post by w35z0r »

=0

Awesome, thank you! Its.... defiantly 5 in the morning... heh...
Post Reply