Laravel data_get helper has different behavior for array and object - development

Laravel data_get helper has different behavior for array and object

$array = ['key' => null];

echo data_get($array, 'key', 'default') // Result was default
$array = (object) $array;
echo data_get($array, 'key', 'default') // Result was null 

Is there any specific reason it was done like this or arrays and objects?

Laravel doc ref



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-data_get-helper-has-different-behavior-for-array-and-object/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

ng-include of inline SVG does not display gradient except in Chrome

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development