note 84825 added to function.substr

From: Date: Thu, 31 Jul 2008 21:17:48 +0000
Subject: note 84825 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-142989@lists.php.net to get a copy of this message
Here is a quick function to get the substring of a string up to and including the last occurrence of $needle function substrtruncate($string, $needle) { return substr($string, 0, strrpos($string, $needle)+1); } $current_dir = substrtruncate($_SERVER['SCRIPT_NAME'], '/'); ---- Server IP: 208.69.120.35 Probable Submitter: 67.160.187.139 ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- https://master.php.net/note/edit/84825 Del: integrated -- https://master.php.net/note/delete/84825/integrated Del: useless -- https://master.php.net/note/delete/84825/useless Del: bad code -- https://master.php.net/note/delete/84825/bad+code Del: spam -- https://master.php.net/note/delete/84825/spam Del: non-english -- https://master.php.net/note/delete/84825/non-english Del: in docs -- https://master.php.net/note/delete/84825/in+docs Del: other reasons-- https://master.php.net/note/delete/84825 Reject -- https://master.php.net/note/reject/84825 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142989) next »