note 79464 added to function.explode

From: Date: Wed, 28 Nov 2007 17:15:49 +0000
Subject: note 79464 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-132638@lists.php.net to get a copy of this message
This function will make the last word in a string red. <? function LastWordColor($text){ $count = count(explode(" ", $text)); $count_last = explode(" ", $text); $i_last = $count - 1; $new_count = $count -2; for ($i = 0; $i <= $new_count; $i++) { echo $count_last[$i] . " "; } echo "<font color=\"#FF0000\">" . $count_last[$i_last] . "</font>"; } echo LastWordColor("Roses are red"); ?> ---- Server IP: 128.39.198.38 Probable Submitter: 83.108.116.238 ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- https://master.php.net/note/edit/79464 Del: integrated -- https://master.php.net/note/delete/79464/integrated Del: useless -- https://master.php.net/note/delete/79464/useless Del: bad code -- https://master.php.net/note/delete/79464/bad+code Del: spam -- https://master.php.net/note/delete/79464/spam Del: non-english -- https://master.php.net/note/delete/79464/non-english Del: in docs -- https://master.php.net/note/delete/79464/in+docs Del: other reasons-- https://master.php.net/note/delete/79464 Reject -- https://master.php.net/note/reject/79464 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132638) next »