note 27815 deleted from function.strpos by aidan
| From: | aidan@php.net | Date: | Wed, 23 Mar 2005 08:10:29 +0000 |
| Subject: | note 27815 deleted from function.strpos by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86829@lists.php.net to get a copy of this message | ||
Note Submitter: mrcheezy at hotmail dot com
----
Hi Everyone,
I've never really had a use for eval() before and used to think it was for novices (which i
still think many applications of it are), however i now know (much like most other functions) it
does have a very usefull role.
Firstly i'd like to thank the user who uploaded the html/php script (you should know which ones
I am referring to) using strpos. But... the i think the while loop was an infinite one. Above it is
called as:
<?php
while (($pos = strpos ($file, '<?')) != FALSE)
?>
but this will keep searching the file over and over again starting at zero. I recomend using
<?php
while ($pos = strpos ($file, '<?', $pos+2))
?>
I'll leave the <?php and <= bit up to you folks...
Next, there were many recomendations to do:
<?php
eval('?>'.$string.'<?php');
?>
but i found that this worked best:
<?php
$string = ''echo 'php only';\n echo 'yay';".';'
eval ($string);
?>
basically just adding a ; to the script. Lastly i haven't had problems with globals..... (yet
:D)
Hope this helped someone,
-Adam