Home > Backend Development > PHP Tutorial > Example of dynamically generated function in php

Example of dynamically generated function in php

WBOY
Release: 2016-07-25 08:53:33
Original
975 people have browsed it
  1. $a['a']=1;
  2. $a['b']=1;
  3. $a['c']=1;
  4. $str="function a(){global $a;if($a['a']==1 && $a['b']==1 && $a['c']==1){return 'OK';}else{return 'ERR';}}";
  5. eval($str);
  6. if(a()=="OK"){
  7. echo "GOOD";
  8. }else{
  9. echo "OH NO";
  10. }
复制代码


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template