note 54871 deleted from function.eval by betz

From: Date: Mon, 18 Jul 2005 15:56:27 +0000
Subject: note 54871 deleted from function.eval by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92118@lists.php.net to get a copy of this message
Note Submitter: Guru Evi ---- I had a problem when I tried to execute the following: <?php while ($row = mysql_fetch_assoc($result)) { if($row['eval'] == "1") { echo "<h2 id=\"" . $row['tag'] . "\">" . $row['title'] . "</h2>" . wordwrap(eval("?>" . $row['content'] . "<?php "),$width_wrap,"\n",0) . "<p>&nbsp;</p>"; } else { echo "<h2 id=\"" . $row['tag'] . "\">" . $row['title'] . "</h2>" . wordwrap($row['content'],$width_wrap,"\n",0) . "<p>&nbsp;</p>"; }; }; ?> As the values came out it seemed like this: eval = 0 >> outputs a correct $row['content'] eval = 1 >> value of eval("?>" . $row['content'] . "<?php ") appended to the previous $row['content'] (yes: in between the </h2> and <p> tag) and $row['content'] was empty in the current iteration of the while statement. eval = 1 >> the same thing happened, the value was appended to the previous $row['content'] which was empty at that time and the current iteration was empty eval = 0 >> outputs a correct $row['content']

« previous php.notes (#92118) next »