I got some problem and I don't know how to fix it.
this is sample for the problem
class DancingClass {
private static $associate = [];
private static $first;
public static function first($param) {
self::$first = $param;
return new self;
}
public function second($param) {
self::$associate["second"] = $param;
return new self;
}
public function finish() {
var_dump(self::$associate["second"]);
$sec = self::$associate["second"] | "";
$all = self::$first . " ditemani oleh " . $sec;
return $all;
}
}
Then I call with chaining method
$callingClass = new DancingClass;
echo $callingClass::first("lucky")->second("adhitya")->finish(); // Return "lucky ditemani oleh adhitya"
echo "<br/>";
echo $callingClass::first("fatur")->finish(); // Return "fatur ditemani oleh"
but I got result like this