How To Limit Characters In A String In Php
how to limit characters in a string in php
how, to, limit, characters, in, a, string, in, php
How To Limit Characters In A String In Php
Post Description: how to limit characters in a string in php
POST# 237
Posted On: Fri Feb 29, 2008 12:01 pm
questions
Topic: How To Limit Characters In A String In Php
hi, im fairly new to php, and i was wondering if its possible to limit the numbers of letter or numbers (characters) in a string. for example, i have this sample code string:

$string = "i have alot of words here and want to make it shorter";

ok, lets say i only want to show the first 15 characters from this string, how would i do that?


Mon Jun 25, 2007 5:12 pm
1
Webune
Reply #762
you would do it like this:

echo substr($string, 0,15);


the output will display something like this:

OUTPUT:
i have alot of


hope this help? if you ever need php web hosting, the best you can find is at www.webune.com

Webune.com has the best php webhoting anywhere. i recommend them to all my customers, they have great support also. i should know, because i am answering this question to you on behalf of Webune.
Thu Feb 28, 2008 5:58 pm
2
rob
Reply #763
Picture 20080228-43530-zzy1p89tgzw1jwo
yes, this is very helpful.

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload