Welcome Guest, Not a member yet? Register   Sign In
need help on substr function on PHP
#1

[eluser]ebot[/eluser]
hello i will love any one to help me out on how to use the substr function on PHP, i will like to use it to limit the number of characters displayed. i don't know if anyone knows where i can get more informations on this

thanks for any help
#2

[eluser]freshface[/eluser]
http://www.php.net/substr
#3

[eluser]Joe_Archer[/eluser]
Code:
substr(string,starting character,[ending character])

ending character is optional.
first character is 0
last character is -1
so to get the first 4 characters of 'Hello' you would do

Code:
substr('Hello',0,3)

if you just want to limit the number of characters displayed in a view, i suggest using Codeigniter's Text Helper which has both word_limiter() and character_limiter() functions.

http://ellislab.com/codeigniter/user-gui...elper.html
#4

[eluser]ebot[/eluser]
Thanks everyone for all help i am greatful you know.
God keep everyone,




Theme © iAndrew 2016 - Forum software by © MyBB