PHP Eval that evaluates HTML & PHP

In case you are trying to do this with a string of mixed HTML/PHP (like from a database, as I was), you can do it this way:

eval(' ?>'.$htmlandphp.'<?php ');

More info: http://blog.5ubliminal.com/posts/eval-for-inline-php-inside-html/ (note this is a dead link as of 2014-3-3)

Leave a Comment