LMSouq
php-dev Open

php create object without class

WO
Wolfgang Adamec
1 month ago
3 views
Problem Description
In JavaScript, you can easiliy create an object without a class by: myObj = {}; myObj.abc = "aaaa"; For PHP I've found this one, but it is nearly 4 years old: http://www.subclosure.com/php-creating-anonymous-objects-on-the-fly.html $obj = (object) array('foo' => 'bar', 'property' => 'value'); Now with PHP 5.4 in 2013, is there an alternative to this?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base