note 8918 deleted from function.strrev by jimw

From: Date: Thu, 01 Nov 2001 22:57:05 +0000
Subject: note 8918 deleted from function.strrev by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20022@lists.php.net to get a copy of this message
Hi, I'm Calin Uioreanu from Romania. For finding the last word of a phrase, i think a nice way would be: &lt;? $str="1adas 2asd 3asdas 4asdasd"; $LastSpacePos = strlen ($str) - strpos(strrev($str), " "); $LastWord = substr ($str, $LastSpacePos, strlen($str)); echo "<br>LastSpacePos=$LastSpacePos"; echo "<br>LastWord=$LastWord"; ?>

« previous php.notes (#20022) next »