PHP Object Array Access: Cannot use object of type stdClass as array

185

To access an object in PHP you use a pointer. For example when using Browscap (http://code.google.com/p/phpbrowscap/) extract the values like so

$current_browser->Parent;


2 comments ↓

If you found this post useful click the share this button. Contribute below by adding a comment, no registration is required.

  • Marian says on 01.31.11 at 1:51 am comment #1

    ok but how to convert them to array?

  • ardeay says on 02.03.11 at 2:11 pm comment #2

    You can cast an object to array like this $newArray = (array) $yourObject;

Leave a Comment