 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
eval() function in PHP
The eval() function evaluates a string as PHP code.
Syntax
eval(code)
Parameters
- code − The PHP code to be evaluated. 
Return
The eval() function returns null unless a return statement is called in the code string. Then the value passed to return is returned. if there is a parse error in the code string, eval() returns false.
Example
<?php    $one = "Demo";    $two = "text";    $res = 'This is $one $two!';    echo $res. "<br>";    eval("\$res = \"$res\";");    echo $res; ?> Output
The following is the output.
This is $one $two! This is Demo text!
Advertisements
 