Most voted "stdclass" questions
stdClass is a predefined PHP class, similar to Object in Java or Python. stdClass objects have no method or properties declared by default, and can still be iterated as a conventional array. The stdClass class is also the default instance when involving a typecasting for (Object).
Learn more…11 questions
Sort by count of
-
9
votes1
answer8659
viewsWhat is the purpose of stdClass in PHP?
What is the purpose of the predefined class stdClass in PHP? In detail what he does? What is its importance?
-
3
votes1
answer1514
viewserror in getting values from stdClass php array
When I use echo var_dump($location); I get this: object(stdClass)#1226 (2) { ["type"]=> string(5) "Point" ["coordinates"]=> array(2) { [0]=> float(44.0928438) [1]=> float(-70.20876942) }…
-
3
votes2
answers1640
viewsHow to know if a stdClass is empty?
In PHP, to check if a array is empty we can use the function (or language constructor) empty. Thus: $a = array(); $b = array(1, 2); var_dump(empty($a), empty($b)); // Imprime: bool(true),…
-
3
votes2
answers319
viewsForeach with PHP Stdclass
My page shows posts that have been registered in the database. Some posts have files that have been uploaded. These files are saved in server folders and the database has the table "Archive" with…
-
2
votes2
answers985
viewsHow to convert stdClass to array recursively?
I have the following object: $a = new stdClass; $a->id = 1; $a->nome = 'wallace'; $a->parentes = new stdClass; $a->parentes->pai = 'Sidney'; $a->parentes->mae = 'Maria'; I know…
-
2
votes1
answer2871
viewsGet values from within stdClass array stdClass
I have this class where I can query and return data from an external webservice: $params = array( 'usuario' => $usuario, 'senha' => $senha, 'quantidade' => 2 ); $wsdl =…
-
2
votes1
answer217
viewsGet data inside stdClass with several stdClass inside each other in PHP
I have as answer this stdClass: stdClass Object ( [Search_AdvancedResult] => stdClass Object ( [ErrorMessage] => [MaxResults] => 1 [NumObjects] => 1 [QueryID] => 242122 [TotalResults]…
-
1
votes5
answers12763
viewsPHP - Transforming object into array
I need to transform an object into an array to be able to traverse it and extract its data, even with you: $array = (array) $object; But the result with a var_dump($array) Here’s the thing, so I…
-
0
votes1
answer798
viewsHow to change a php object’s value
I’m passing an object created in a jQuery file to php and getting it from the following code. $data = $_POST['data']; $d = json_decode($data); $user = $d->user; $season = $d->season;…
-
0
votes0
answers38
viewsCompare map<string,any> c++ 17
I can’t compare two maps . Ex: map<string, any> columnsMap = { {"status", 1}, {"client_delivered", 0}, {"client_notification", 0}}; map<string, any> columnsMap2 = { {"status", 1},…
-
0
votes1
answer151
viewsHow to get the items inside an Object(stdClass) in PHP?
I’m importing with PHP for an api, and I don’t know how to get the values of object(stdClass) who are inside the $fotos. I tried it both ways below, but I believe I’m wrong: foreach($fotos as $f){…