Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何重写php函数_Php_Function_Overriding - Fatal编程技术网

如何重写php函数

如何重写php函数,php,function,overriding,Php,Function,Overriding,我有一个页面调用这个php页面的函数 myfunction.php function create($array) { /* create new one in db */ } function modify($array) { /* modify a row in database */ } function delete($array) { /* delete a row from database */ } ... (other function) include myfuncti

我有一个页面调用这个php页面的函数

myfunction.php

function create($array) { /* create new one in db */ }

function modify($array) { /* modify a row in database */ }

function delete($array) { /* delete a row from database */ }

... (other function)
include myfunction.php

function create($array) { /* create new one in db */ } 
并有一些网页,需要不同的创建内容功能

然后我创建了这个文件,但出现了错误

myfunction2.php

function create($array) { /* create new one in db */ }

function modify($array) { /* modify a row in database */ }

function delete($array) { /* delete a row from database */ }

... (other function)
include myfunction.php

function create($array) { /* create new one in db */ } 

创建函数文件并在需要时重写的最佳方法是什么?

您可以将匿名函数分配给变量,然后如果它存在,取消设置它:看看这个更好地使用oop和类继承的方法