Home > Backend Development > PHP Tutorial > php function_exists function problem, repeatedly defining functions

php function_exists function problem, repeatedly defining functions

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:21:29
Original
1775 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:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template