我有一个名为Validation
的类和名为array
的方法。由于array
在PHP中的内置函数及其引发错误如何在类中使用内置函数名称作为方法名称
Parse error: syntax error, unexpected 'array' (T_ARRAY), expecting identifier (T_STRING) in D:\xampp\htdocs\mvc\app\validation.php on line 82
有没有一种方法,我可以用数组作为方法的名字吗?
//This is a class
class Validation extends Controller{
//This is a method
public function array($field, $name){
}
}
检查http://stackoverflow.com/questions/5298507/can-i-use-php-reserved-names-for-my-functions-and-classes – Saty
无法使用内置函数。 –