HTML2011. 5. 10. 10:51

ASP -> PHP Left() & Right()

Posted 07 August 2008 - 06:33 AM

Just had to write two functions for one of our developers that's migrating from ASP to PHP and thought that they were actually quite useful (I'm sure most of you already have something like this, I've just never had the need)

It's PHP's version of the ASP's left() and right() functions:


1 function right($value, $count){
2     $value = substr($value, (strlen($value) - $count), strlen($value));
3     return $value;
4 }


1 function left($string, $count){
2     return substr($string, 0, $count);
Posted by 아이맥스