Home > Backend Development > PHP Tutorial > PHP如何替换或重定义内置函数

PHP如何替换或重定义内置函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:28:07
Original
2773 people have browsed it

如果想用自定义的同名函数,替换PHP内置的函数,这个该如何实现

回复内容:

如果想用自定义的同名函数,替换PHP内置的函数,这个该如何实现

http://php.net/manual/zh/function.override-function.php
我不会PHP

你为什么要覆盖内置函数?难道别人的有bug? 如果是达不到你的需要,你可以重新定义一个函数。
覆盖内置函数按我的理解是很危险的行为,假如你的有问题,其他php模块依赖这个函数岂不是都会出错?

不提倡这么做,建议你使用namespace来解决问题

重写 PHP 内建函数,未实践

Related labels:
php
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
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