How To Display Show The Last Characters In A String PHP
how to display show the last characters in a string php
how, to, display, show, the, last, characters, in, a, string, php
How To Display Show The Last Characters In A String PHP
Post Description: how to display show the last characters in a string php
POST# 426
Posted On: Fri Feb 29, 2008 12:01 pm
web hosting
Topic: How To Display Show The Last Characters In A String PHP
supposed i hava a string and the the value ot the string is: i love wallpaperama.com even more
so this is how the PHP would look like so far:
$string = 'i love wallpaperama.com even more';


now, lets say i don't want the ten characters ( even more) to show i only want i love wallpaperama.com. so if want to erase the part that says ' even more' this is how my code would look like so far:
$string = 'i love wallpaperama.com even more';
$string = substr($string, 0,23);

What the substr() function tells php is that to on get the first first 23 charracters starting a 0, therefore, removing the last 10 characters, so if i were to echo $string, the value would come out like this i love wallpaperama.com

here's the complete script:
<?
$string = 'i love wallpaperama.com even more';
$string = substr($string, 0,23);
echo string;
?>


OUTPUT:
i love wallpaperama.com



COURTESY: thanks to the webune.com team for their help on this. Find PHP hosting and more scripts at www.webune.com

NEXT: how to display the last characters of a string in PHP



No Repies
(0) Comments for How To Display Show The Last Characters In A String PHP

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