<?php
/*
class myName{
public function __construct($prop){
echo $prop;
}
}
$obj = new myName('testing');
*/
$obj = new class('testing'){
public $var;
public function __construct($var){
$this->$var=$var;
}
};
var_dump($obj);
Deprecated: Creation of dynamic property class@anonymous::$testing is deprecated in /in/3OflN on line 22
object(class@anonymous)#1 (2) {
["var"]=>
NULL
["testing"]=>
string(7) "testing"
}