How can I convert content of a one line string into a code, that actually executes? Lets say that I intend to run the following code:
<?php
$sum=0;
for($i=1;$i<11;$i++){
$sum+=$i;
}
echo $sum;
?>
but part of the code is a content of a string $s:
<?php
$sum=0;
$s="for($i=1;$i<11;$i++){";
//what to write here to use the content of the string $s as a code
$sum+=$i;
}
echo $sum;
?>
EDIT: I am dealing with the hypothetical question, the two source codes are just an illustration.