method toObject documentation in bbn\X

Converts a JSON string or an array into an object.

Example

X::toObject([[1, 'Test'], [2, 'Example']]); // (object) {[1, 'Test'], [2, 'Example']} function($ar) { if (\is_string($ar)) { $ar = json_decode($ar); } elseif (\is_array($ar)) { $ar = json_decode(json_encode($ar)); } return (object)$ar; }

Converts a JSON string or an array into an object. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.