PHP - Preg_match_all - Regular Expression - help
i've been working on this question since yesterday, i have the following code..
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
echo "evalia:".$param[1]."<br>";
$i=0;
while($i<100)
$i++;
?>
cvbcbcbcvb
<?php
echo "asdsad";
for($i=0;$i<100;$i++)
{
echo $i;
}
?>
and i need to get what is inside the tag.... can anyone help me?
ok i explained myself really badly.... in another page i use file_get_contents to get this code ( this is only a test page nothing more) ... i can't use include for a serious reason so 开发者_StackOverflow中文版i need to use eval on the code inside the php tag so what i really need is the regular expression to grab everything inside the tag..
Im my opinion you don't need to extarct the code from php tags. You can just eval all the content of the file:
eval(" ?>$file_content<?php ");
You can still use include which is actually quite like eval:
include('data:text/plain;base64,'.base64_encode($file_content));
See data://
Docs for details about the data: (» RFC 2397) stream wrapper.
See as well Karolis answer.
preg_match("|<\?php(.*?)\?>|msU", $string, $match);
eval($match[1]);
is it your answer?
精彩评论