Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- MySQL
- mod_unique_id
- httpd-autoindex.conf
- vim color scheme
- Repository
- jQuery
- Node.js apache 연동
- PHP 5.2.17 .ini
- httpd-vhosts.conf
- CentOS 6.10
- MySQL 5.1.41
- httpd.conf
- PHP 5.2 .ini
- httpd-info.conf
- CentOS
- httpd-dav.conf
- gcc update
- unique_id
- httpd-default.conf
- vimrc 옵션
- epel repository
- node.js
- httpd 2.2.32
- httpd-mpm.conf
- Mod_Security 룰 셋
- python 3.5.10
- CentOS 6
- apache 연동
- python 3.X 소스 설치
- Node.js 소스 설치
Archives
- Today
- Total
곰시기's
[PHP] - 문자열 앞까지 자르기 본문
function contentEnd( $content, $string, $len_include = false ) {
if( "5.3" <= phpversion() ) {
$content = strchr( $content, $string, true );
// PHP ver 5.3~ 세번째 인자 bool값 지정 가능
// bool값 : ture : 검색한 문자열의 앞에 존재 하는 string을 반환
// : false : default값으로 검색 문자 뒤의 string을 반환
}
else{
$tmp = stripos( $content, $string ); // '$string'앞에서 자르기 위해 위치 탐색
if( $len_include ) {
$tmp += strlen( $string ); // $len_include 값이 true 면 검색 문자열 포함 false면 검색 문자열 앞 까지
}
$content = substr( $content, 0, $tmp );
}
return $content;
}
'Web Development > PHP' 카테고리의 다른 글
[PHP] - Select Box (0) | 2021.02.16 |
---|---|
[PHP] - JsonEncoder 함수 (0) | 2021.02.16 |
[PHP] - 간단한 iconv 함수 (0) | 2021.02.16 |
[PHP] - 원격지 파일 다운로드 (0) | 2021.02.16 |
[PHP] - mysql_free_result (0) | 2021.01.20 |
Comments