함수 substr until()

Jmnote (토론 | 기여)님의 2016년 4월 22일 (금) 18:09 판 (Jmnote 사용자가 함수 substr until 문서를 함수 substr until() 문서로 옮겼습니다)
substr_until

1 PHP

function substr_until($needle, $haystack) { return ($pos=strpos($haystack,$needle))? substr($haystack,0,$pos).$needle : false; }

echo substr_until('ll', 'hello world');
echo substr_until('l', 'hello world');
echo substr_until('x', 'hello world'); // bool(false)
# hell
# hel
#

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}