Linked Questions

28 votes
6 answers
53k views

I'm using amazon product advertising api. Values are returned as a multidimensional objects. It looks like this: object(AmazonProduct_Result)#222 (5) { ["_code":protected]=> int(200) ["...
Giri's user avatar
  • 4,909
27 votes
7 answers
38k views

My array is like: Array ( [0] => stdClass Object ( [id] => 1 [name] => demo1 ) [1] => stdClass Object ( [id] => 2 ...
Thompson's user avatar
  • 2,010
-1 votes
2 answers
7k views

I am wondering if there is a built-in way in PHP to cast multidimensional objects to arrays? The problem is when applying a regular casting on an object, the first dimension only is being affected, ...
Boarking's user avatar
1 vote
1 answer
359 views

Actually i am not able to convert php object to array and specially when i have other access specifier. for example: <?php class Foo { public $bar = 'barValue'; protected $baz = '...
manish1706's user avatar
  • 1,609
0 votes
0 answers
478 views

I'm working with Laravel, and I have an Object that I must push to my DB, the thing is, this is an Object, and I need it to be an array to push it in, Ill explain here: so, this is how Im pushing in ...
Eran Levi's user avatar
  • 909
0 votes
0 answers
162 views

I have this php code, i need to know is it possible $data objects put as array, I wanna return result as: Array ( [0] => stdClass Object ( [rate] => 1 [currencyCode] => USD ) [1] => ...
Asker's user avatar
  • 1
0 votes
0 answers
51 views

When I use get_object_vars() php function, public variables are all fine to convert to array but the problem is private and protected variables. Is there any way or good way to convert it?
Chris Mok's user avatar
511 votes
35 answers
1.2m views

How can I convert an array like this to an object? [128] => Array ( [status] => "Figure A. Facebook's horizontal scrollbars showing up on a 1024x768 screen resolution." ...
streetparade's user avatar
110 votes
11 answers
143k views

I'm using a third party storage system that only returns me stdClass objects no matter what I feed in for some obscure reason. So I'm curious to know if there is a way to cast/convert an stdClass ...
The Mighty Rubber Duck's user avatar
37 votes
14 answers
267k views

Laravel output: Array ( [0] = stdClass Object ( [ID] = 5 ) [1] = stdClass Object ( [ID] = 4 ) ) I want to convert this into normal array. Just want to ...
Your Friend's user avatar
  • 1,169
51 votes
7 answers
40k views

I have never really thought about this until today, but after searching the web I didn't really find anything. Maybe I wasn't wording it right in the search. Given an array (of multiple dimensions or ...
Chuck Burgess's user avatar
29 votes
6 answers
12k views

I have a PHP array that has numeric keys as a string type. But when I try and access them PHP is giving me an undefined index error. $a = (array)json_decode('{"1":1,"2":2}'); var_dump($a); var_dump(...
Petah's user avatar
  • 46.2k
26 votes
7 answers
22k views

I am returning a json_encode() of an array of objects pulled from an ORM. It includes lots of properties with a null value. What is the neatest way to remove these properties that are null? I guess ...
Darren's user avatar
  • 3,069
14 votes
3 answers
24k views

foreach($categories as $category) { print_r($category); } The code above gives me the following result. stdClass Object ( [category_Id] => 4 [category_Title] => cat 4 ) stdClass ...
Afshin's user avatar
  • 2,447
12 votes
6 answers
16k views

I need to convert this array Array ( [0] => stdClass Object ( [title] => primo ) [1] => stdClass Object ( [title] => secondo )) to Array ( [primo] => primo [secondo] =...
Ponzio Pilato's user avatar

15 30 50 per page
1
2 3 4 5