note 33675 added to function.eval
| From: | paq at libero dot it | Date: | Thu, 03 Jul 2003 15:57:58 +0000 |
| Subject: | note 33675 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51467@lists.php.net to get a copy of this message | ||
/*in database ho HTML e PHP
mischiato ecco come ho risolto per far
scrivere HTML e per ottenere il PHP interpretato.
ciao
$srt = il risultato della query
*/
/*in a database i have a mix of HTML and PHP
that's the way i get html and PHP
$srt =result of a query
ex:
<table width="437" border="0" cellspacing="0"
cellpadding="2" >
<tr>
<td width="213" bgcolor="#FFFFFF" align="center"
class="text_blu">LOGO TIPO</td>
<td width="232" class="text_small"><? echo
$campo_array[XUIL104];?><br>
<? echo $campo_array[XUIL104];?></td>
</tr>
</table>
sorry for bad english
*/
$x= strlen($str);
$start=0;
$end =0;
for ($RR=0;$RR<=$x;$RR++){
if($str[$RR] == "<" && $str[$RR+1] == "?") {
$start = $RR + 2;
}
if($str[$RR] == "?" && $str[$RR+1] == ">") {
$end = $RR ;
$rrr = $end - $start;
$php = str_replace("\"","'",substr($str, $start, $end - $start));
eval($php);
$start=0;
$RR=$RR+2;
}
if(!$start){
echo $str[$RR];
}
}
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33675
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33675&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33675&report=yes