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:
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);
|
'HTML' 카테고리의 다른 글
★ php ★ php 와 ms-sql 2000/2008 연동주의 (0) | 2011.05.12 |
---|---|
★ php ★ [php 입문][유용] 변수, 상수 및 데이터형 (0) | 2011.05.11 |
★ php substr ★ PHP 시간처리 (MySQL, time, substr, mktime) (0) | 2011.05.10 |
★ php substr ★ [php함수] strpos(),strrpos(),strrchr(),strstr(),substr() (0) | 2011.05.10 |
★ php substr ★ PHP 함수 substr() 사용법 (0) | 2011.05.10 |