note 27815 modified in function.strpos by vincent
| From: | vincent@php.net | Date: | Sun, 07 Sep 2003 11:41:12 +0000 |
| Subject: | note 27815 modified in function.strpos by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55564@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:
<?php
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
--was--
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