how to make long string shorter in php making big string short

RegisterLogin
how to make long string shorter in php making big string short
Post Description: how to make long string shorter in php making big string short
Tags: how, to, make, long, string, shorter, in, php, making, big, string, short
This Post Was Posted On Feb 29, 2008 By web hosting #1315
ok, lets say you have a long string, lets say i have an image (picture) file thats very long but i want to limit the amount of the string length i ca do this.

so if i have a string like this:

$long_string = 'zzy1p89tgzw1jwol3bk7p-xicpaiuugwwo7rxpppcml1rnurl6ailtp-2mpq96qej63sd7n.gif';

now, i only keep the last 15 characters of the file name to make it short i can use this
<?php
$max_filename_chars = 15;
$long_string = 'zzy1p89tgzw1jwol3bk7p-xicpaiuugwwo7rxpppcml1rnurl6ailtp-2mpq96qej63sd7n.gif';
$long_string = substr($long_string, - $max_filename_chars);
echo $long_string;
?>

so now the value of will be 96qej63sd7n.gif

Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
tony
#1744 1
20080228-43539-jubcvatfrpaisv-p.gif
yes, i like this tutorial, it help me. thanks
Feb 28, 2008 Reply Report abuse
©2011 Webune Forums - Wed Dec 21, 2011 3:47 am
Powered by: Webune Forums V3