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:
Post Tags: how, to, display, show, the, last, characters, in, a, string, php
This Post Has Been Viewed 356 Times Since Thu Jul 12, 2007 7:12 am Posted By hostman with 0 replies
Next Post »» how to check repeated letters characters forms string repeat
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


Leave Your Comments     [ dejar commentarios ]
  * Name     [nombre]

  * eMail (will not be published)     [coreo electronico]

* Enter Your Reply or Comments:    [commentarios]


Add Picture To Comments         [incluir foto]
YES NO             upload
Receive Replies on my Comments (An email will be sent to you when someone replies to your comments)

     

Comments and replies About How To Display Show The Last Characters In A String PHP




(0) Comments