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)
More Related Contents:
- How do I store a custom user selected CSS template style (like wordpress visual editor)? [closed]
- What is ENDIF doing in templates? [closed]
- PHP: What’s the speed difference “template” vs “quote”? [duplicate]
- How can I echo HTML in PHP?
- WooCommerce action hooks and overriding templates
- Opening/closing tags & performance?
- Best method of including views within views in CodeIgniter
- WooCommerce: Assigning an endpoint to a custom template in my account pages
- PHP vs template engine [closed]
- Using PHP as a template engine
- vsprintf or sprintf with named arguments, or simple template parsing in PHP
- Dirt-simple PHP templates… can this work without `eval`?
- PHP regex templating – find all occurrences of {{var}}
- Laravel 5 get view name
- how to read Json values [closed]
- How do I convert a string to a number in PHP?
- Does PHP have short-circuit evaluation?
- Truncate text containing HTML, ignoring tags
- Transfer in-memory data to FTP server without using intermediate file
- Subquery in doctrine2 notIN Function
- Access to Laravel 5 app locally from an external device
- How to decode eval( gzinflate( base64_decode(
- What are the differences between backtick and single quote? Can I use IF statement in a query as above?
- I cannot use mysql_* functions after upgrading PHP
- How to get whole and decimal part of a number?
- Getting error mysqli::real_connect(): (HY000/2002): No such file or directory when I try to access my project on live server [duplicate]
- Token was deauthenticated after trying to refresh it
- Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class.smtp.php on line 197
- Decoding numeric html entities via PHP
- How to Load Ajax in WordPress