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
0
votes
1 answer

Foreach loop from stdClass object

For this array stdClass Object ( [YearsResult] => stdClass Object ( [years] => stdClass Object ( [year] => Array ( [0] => 2013 …
Diane
  • 103
  • 2
0
votes
2 answers

php array sorting by date stdClass Object

I have an array of something like this: Array ( [0] => stdClass Object ( [id] => 41 [title] => test2 [alias] => test2 [catid] => 8 [published] => 1 [introtext] => test2 [fulltext] => [video] => [gallery] => [extra_fields] => []…
andy
  • 177
  • 2
  • 12
0
votes
3 answers

PHP How to output the array content

A function returns array of following type: Array ( [0] => stdClass Object ( [post_id] => 48 I want to echo the array contents, so i tried using following foreach loop: foreach ($posts as $post){ echo $post['post_id']; } But I get following…
user1355300
  • 4,867
  • 18
  • 47
  • 71
0
votes
1 answer

Parsing stdClass() object with Smarty

So I pass a PHP stdClass() object to Smarty, which looks like this, for example : stdClass Object ( [1] => stdClass Object ( [id] => 1 [children] => stdClass Object ( [4123] =>…
bogatyrjov
  • 5,317
  • 9
  • 37
  • 61
0
votes
1 answer

Cannot access element in array converted from stdClass created by json_decode

$arr = array(); $arr[0] = "2a123"; $arr[1] = "2123"; $arr["other_option"] = "2123"; var_dump($arr); $arr = json_encode($arr); $arr = (array)json_decode($arr); var_dump($arr); var_dump( $arr[1]); var_dump( $arr["1"]); The output of 2 last…
Hieu Vo
  • 3,105
  • 30
  • 31
0
votes
1 answer

how could I pass my stdClass into an array?

I've got an stdClass coming from my database : $query = $this->db->get('news'); if(isset($options['id']) || $options['limit'] == 1) return $query->row(0); And I would like to pass it to my variable : $data['news'] =…
Miles M.
  • 4,089
  • 12
  • 62
  • 108
0
votes
2 answers

PHP SOAP stdClass

I want to get info of an external serve with SOAP. When i do a print_r of that SOAP call i get: stdClass Object ( [Ticket] => stdClass Object ( [Timestamp] => 2012-07-24T17:46:01.306+02:00 [ExpiryTimestamp] =>…
user1079160
  • 811
  • 1
  • 7
  • 11
0
votes
3 answers

Accessing a PHP stdClass Object in Javascript/Smarty

I have a stclass object which i am initializing in PHP code. The object returns object(stdClass)[238] public '0' => string 'Jun 20, 2012 03:02 PM' (length=21) public '1' => string 'Jun 20, 2012 03:26 PM' (length=21) public '2' => string 'Jun…
CodeMonkey
  • 2,265
  • 9
  • 48
  • 94
0
votes
1 answer

Decode JSON result stdClass Object() to a formatted HTML

how does one decode a JSON to an html list, and be able to dumb it into a 'div' or DOM element, or am I missing something? stdClass Object ( [msc] => 26771010150 [number] => 2677410930 [status] => OK [msc_mcc] => 652 [imsi] => 652010151221139…
user1099258
0
votes
1 answer

Notice: Undefined property: stdClass::$dis_comment in class_post.php on line X

i write follow code in a class_post.php : $this->post_message = stripslashes($obj->message); $this->post_date = intval($obj->date); $this->comments_disabled = intval($obj->dis_comment); $this->post_mentioned = array(); $this->post_attached …
iman aletaha
  • 31
  • 1
  • 8
0
votes
1 answer

Read a SQlite3 .db file with/from PHP: stdClass::error

I have a file.db (binary) that I can read from SQlite 3.exe, but I want to echo out the information with a while ordered in a table. I have the following code: prepare("SELECT * FROM `Timers`…
Bona Chon
  • 955
  • 3
  • 9
  • 11
-1
votes
1 answer

How to Parse a return of a Std Class object from a SoapClient command into a XML

The response of a SoapClient command returned it: stdClass Object ( [ExecutarXMLResult] => stdClass Object ( [any] =>
fhnaylor
  • 45
  • 2
  • 14
-1
votes
1 answer

How to print status from this using PHP

stdClass Object ( [status] => success [message] => stdClass Object ( [key] => stdClass Object ( [remoteJid] => 911334567890@c.us [fromMe] => 1 …
-1
votes
1 answer

Add more values to stdClass Object

I have two results sets $result1 and $result2 which are returning below results. $result1 contains 1 record and $result2 has 2 records. How can i append $result2 into $result1 at index[1] without hardcoding index? $result1 may have many records so i…
Neeraj
  • 8,625
  • 18
  • 60
  • 89
-1
votes
1 answer

Error : Object of class stdClass could not be converted to string

I don't understand what's wrong with the code I created public function postRegister(Request $request) { $admin = new SuperAdmin(); $admin->NIP = Input::get("NIP"); $admin->username = Input::get("username"); …
Fazan
  • 5
  • 3