I am learning PHP but I encountered a new problem. I would appreciate if you help.
My code:
$idTrack = (new Track_Obj)->getIdtCommon($a,$b);
Class Track_Obj{
function __construct( $idtakip, $env = false ) {...}
function getIdtCommon( $idref, $idstudent, $env = false) {...}
}
Error:
Uncaught ArgumentCountError: Too few arguments to function Track_Obj::__construct(), 0 passed in and at least 1 expected in PHP7.1
Solve:
New code:
$idTrack = (new Track_Obj($idtakip))->getIdtCommon($a,$b);
or
$class=new Track_Obj($idtakip);
$idTrack = $class->getIdtCommon($a,$b);
Thank you for help and explanation @Phil
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.