php function_exists function problem, repeatedly defining functions

WBOY
Release: 2016-08-04 09:21:29
Original
1683 people have browsed it

<code>$a=get(1);  //出错,找不到定义
echo $a;
if(!function_exists("get")){
   function get($a){
      return "test";
   }
}</code>
Copy after login
Copy after login

If you want to realize the function, you need to check whether the function is defined. If it is, it will not be defined. If not, just define it.
The function_exists position is at the end of the file, and it will prompt that the function definition cannot be found

Reply content:

<code>$a=get(1);  //出错,找不到定义
echo $a;
if(!function_exists("get")){
   function get($a){
      return "test";
   }
}</code>
Copy after login
Copy after login

If you want to realize the function, you need to check whether the function is defined. If it is, it will not be defined. If not, just define it.
The function_exists position is at the end of the file, and it will prompt that the function definition cannot be found

<code class="php">if(!function_exists("get")){
   function get($a){
      return "test";
   }
}
$a=get(1); // 这不就找到了
echo $a;</code>
Copy after login

Recommended methodis_callable, manual

Explanation of sequential execution..

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!