- Forums
- PHP
- How To Make Long String Shorter In Php Making Big String Short
This Page Contains information about How To Make Long String Shorter In Php Making Big String Short By wallpaperama in category PHP with 1 Replies. [1105], Last Updated: Sat May 18, 2024
wallpaperama
Thu Feb 28, 2008
1 Comments
2288 Visits
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