Eval function: \ Application

Source: Internet
Author: User
<? PHP $ string = "beautiful"; $ time = "Winter"; $ STR = 'this is a $ string $ Time Morning! '; Echo $ Str. "<br/> ";Eval ("\ $ STR = \" $ STR \";");Echo $ STR;?>
This is a model: eval ("xxx = xxx ;");
Eval is not a simple parameter, but a value assignment expression. You can think like this:
Step 1: Perform the value assignment operation
Step 2: run the assigned result in PHP code.
Focus on the right half of = first:
If this is the case,
Xxx = "$ Str", "$ Str" is treated as a string for operations
Xxx = \ "$ STR \", \ escaped ", $ STR is assigned as an object, which is exactly what we want
Then look at the left half of =:
Because it is a value assignment operation, add \
Finally:
Eval performs an operation on the final parameter $ STR to obtain the result.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.