Home > Backend Development > PHP Tutorial > php概念-变量函数

php概念-变量函数

WBOY
Release: 2016-06-13 13:03:35
Original
1257 people have browsed it

php概念--变量函数

<?php function zhang(){
        echo "My name is zhang, \n";
    }
    function noname($name){
      echo "My name is $name, \n ";
     }
    $show = 'zhang';
    $show();      //<span style="color: #ff00ff;">这与写 zhang()一样;
    $show = 'noname';
    $show(Harry);   // <span style="color: #ff00ff;">这与编写noname('Harry') 一样;</span>
?>
Copy after login
?变量函数是php最优秀的功能,在一个变量名后面附加()后,php就会尝试寻找具有相同名称的函数并试图执行它

1 楼 lanlansnss 2012-03-05  
{$show}('harry');

2 楼 lanlansnss 2012-03-05  
博客非常的好,尤其是js部分。特别的细致。
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