note 74770 added to function.explode

From: Date: Thu, 26 Apr 2007 21:08:38 +0000
Subject: note 74770 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-125899@lists.php.net to get a copy of this message
<?php // returns a string where $variables are replaced with their global value if available; removes all extra whitespaces function evaluateString($string) { if ($string) { // check for value $array = explode(' ', $string); // split into parts foreach ($array as $word) { // each part if ($word[0] == '$') { // is part a variable if ($word = substr($word, 1)) { // get variable name global ${$word}; // retrieve global value $html .= ${$word}; // add value to string } // end variable name check } else { // not a variable $html .= $word; // add word to string } // end variable check $html .= ' '; // add space between words } // end part loop } // end string check return trim($html); // trims final space from end } // end evaluateString ?> ---- Server IP: 69.147.83.197 Probable Submitter: 68.104.59.102 ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- https://master.php.net/note/edit/74770 Del: integrated -- https://master.php.net/note/delete/74770/integrated Del: useless -- https://master.php.net/note/delete/74770/useless Del: bad code -- https://master.php.net/note/delete/74770/bad+code Del: spam -- https://master.php.net/note/delete/74770/spam Del: non-english -- https://master.php.net/note/delete/74770/non-english Del: in docs -- https://master.php.net/note/delete/74770/in+docs Del: other reasons-- https://master.php.net/note/delete/74770 Reject -- https://master.php.net/note/reject/74770 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125899) next »