Questions tagged [stdclass]

`stdClass` is php's generic empty class, kind of like Object in Java or object in Python.But not actually used as universal base class. Useful for anonymous objects, dynamic properties. It is used when casting other types to objects.

stdClass is php's generic empty class, kind of like Object in Java or object in Python.But not actually used as universal base class. Useful for anonymous objects, dynamic properties. It is used when casting other types to objects.

503 questions
-1
votes
1 answer

How to pass JSON response in PHP to Javascript

I have problems passing a JSON request from PHP to Javascript. I am sending a request to my Flask RESTful API and I'm recieving a JSON reponse (I believe). PHP: $urlContents = file_get_contents("http://192.168.2.201:5000/dataprovider", false,…
-1
votes
1 answer

Convert stdClass object with multiple entries/value to array in PHP

I fetch $pmpro_levels from postmeta as: when i try print_r($pmpro_levels); I have array like this: $pmpro_levels=Array ( [2] => stdClass Object ( [id] => 2 [name] => PREMIUM [description] =>
-1
votes
1 answer

Array with Objects add to new Array as Child

i feel stupid right now i cant get my head around it i got a array with stdClass Objects and i whant sort them new or build a other array with it Array ( [0] => stdClass Object ( [id] => 15 [top_id] => 13 …
Limuz
  • 5
  • 3
-1
votes
1 answer

PHP Laravel (Shopify App) how to access Guzzle response(stdclass) data parameters

I am working on Shopify App using Laravel and used Osiset/Larave-Shopify Package. Currently I am trying to access response from Shopify Webhooks and package returns data in stdclass object. Simply I want to access email from the following response…
Jagdeesh Kumar
  • 1,640
  • 2
  • 13
  • 29
-1
votes
2 answers

Separate received from web-service as object std class

I got this from web service and tried so many solution that I found in similar topics, but couldn't separate them to use in my code: stdClass Object ( [getPropsListResult] => [ { "id":16461, …
Omid
  • 21
  • 7
-1
votes
1 answer

Fatal Error: Cannot use object of type stdClass as array?

I'm quite new to PhP; My website suddenly stopped working tonight for no reason and once I have debugged my PDO script, it returns this error: Cannot use object of type stdClass as array in /var/www/html/v1/framework/api/stats.php:5 Stack trace: #0…
Jaiden
  • 3
  • 2
-1
votes
1 answer

Accessing Std Class Object values from JSON string in PHP

I am receiving a JSON string from an API, which I am then decoding into an array. The array is full of stdClass Objects and arrays, but I cannot seem to access the properties. This is the array I have decoded from JSON and then called print_r…
Dan
  • 1,154
  • 1
  • 7
  • 14
-1
votes
3 answers

Manage SQL query multidimensional array output as stdClass Object

I using an MVC framework with controllers and routes on PHP 5.6. I am trying to define some PHP variables from the database. +---------+---------+-------------+---------------+ | meta_id | post_id | meta_key | meta_value …
Mau
  • 1,257
  • 2
  • 15
  • 21
-1
votes
1 answer

How to pass a json object to a method which has a typed parameter in PHP 7.1.x

I'm having a PHP file, which will receive the POST data. Moreover I'm having a function which has a typed parameter. If I pass the POST data to that function it throws a FATAL ERROR. I depicted the scenario in a simple code to reproduce the…
-1
votes
1 answer

need to convert string namespace to stdclass

I am using this name space use \App\Model\PostsModel; and i am trying to access the class like this in another class : public $model = PostsModel::class; the out put of vardump is "App\Model\PostsModel" and vardump shows that the type of it…
Iman Emadi
  • 421
  • 4
  • 14
-1
votes
2 answers

Parse String of objects of stdClass in php

I have a array of string of stdClass objects but i am not able to parse the string correctly I have tried various methods but all gives the same error of "get property of non-object" foreach($response->Product->$x as $prod) { print…
Ali Yar Khan
  • 1,231
  • 2
  • 11
  • 33
-1
votes
1 answer

How to iterate this stdClass in PHP

Can you help to iterate this stdClass with a loop? I want to print just the values. stdClass Object ( [GetInfoResult] => stdClass Object ( [string] => Array ( [0] => My Value 1 [1] => My Value 2 [2] => My Value 3 [3] => My Value 4 [4] => My val 5…
-1
votes
1 answer

Notice: Undefined property: stdClass::$images in

i have a problem with a stdObject. i did not find a solution for my problem. there are products that have images [products] => array ( [0] => stdClass Object ( [images] => Array ( …
-1
votes
2 answers

Fatal error: Cannot use object of type stdClass as array in ... on line 10

I get this error message: Fatal error: Cannot use object of type stdClass as array Code: if(isset($_POST['anmelden'])) { $email = $_POST['email']; $passwort = $_POST['passwort']; $statement = $pdo->prepare("SELECT * FROM…
Freddy
  • 1
  • 3
-1
votes
2 answers

Get value from STDClass

I'm using PHP and CodeIgniter. I ran a query using the following script: $query = $this->db->query('select login_id, date_created from prjsite_login'); $row = $query->result(); print_r($row); The result of the print_r is: Array ( [0] => stdClass…
cracker_chan
  • 93
  • 1
  • 3
  • 11