Preg_replace rotate PHP code

Source: Internet
Author: User
Preg_replace there is a piece of PHP code replacing the PHP code. I want to change all characters between & lt; a & gt; and & lt;/a & gt; to uppercase PHPcodea = '& lt; a & gt; & lt ;? Php $ str = \ '0 \ '; if ($ str = \ '0 \') {echo $ str ;}? & Gt; & lt; preg_replace replacing PHP code
There is a piece of PHP code. I want to convert all the characters to uppercase.

PHP code
  A ='

  '; Echo preg_replace ("/(.*?) <\/A>/es ", '" ". strtoupper (" \ 1 ")." "', $ );


The output result is always incorrect. Some strings are always executed as PHP code (for example, the output result $ str is lost). how can I output the correct result? Or is there any other way to achieve this?

Thank you!

------ Solution --------------------
PHP code
$ A ='

  '; Echo preg_replace_callback ("/(.*?) <\/A>/s ", 'foo', $ a); function foo ($ r) {return "". strtoupper ($ r [1]). "";}

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.