note 27815 added to function.strpos
| From: | mrcheezy at hotmail dot com | Date: | Thu, 19 Dec 2002 19:24:53 +0000 |
| Subject: | note 27815 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41128@lists.php.net to get a copy of this message | ||
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:
while (($pos = strpos ($file, '<?')) != FALSE)
but this will keep searching the file over and over again starting at zero. I recomend using
while ($pos = strpos ($file, '<?', $pos+2))
I'll leave the <?php and <= bit up to you folks...
Next, there were many recomendations to do eval ('?>'.$string.'<?php');
but i found that this worked best:
$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
--
http://www.php.net/manual/en/function.strpos.php
http://master.php.net/manage/user-notes.php?action=edit+27815
http://master.php.net/manage/user-notes.php?action=delete+27815
http://master.php.net/manage/user-notes.php?action=reject+27815