<?php
class zyf{
public $a=6;
public $b;
function zyf() { //创建构造方法, 也可以使用zyf()
echo $this->a;
}
function add($a,$b){
$c=$a+$b;
}
$xin = new zyf(); //实例化一个具体的对象xin 一经实例化后,马上调用构造方法,显示输出结果 6
$xin->add(1,4)
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in fCZm2 on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in fCZm2 on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in fCZm2 on line 3
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in fCZm2 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in fCZm2 on line 3
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/fCZm2 on line 3
Process exited with code 255.