Linked Questions
23 questions linked to/from How to convert an stdClass to an array?
-2
votes
1
answer
110
views
Converting a stdClass intro an array [duplicate]
stdClass Object
(
[CountyId] => 3
[Name] => Alba
[Abbreviation] => AB
)
stdClass Object
(
[CountyId] => 4
[Name] => Arad
[Abbreviation] => AR
)
stdClass ...
658
votes
41
answers
746k
views
How can I get useful error messages in PHP?
Quite often I will try and run a PHP script and just get a blank screen back. No error message; just an empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon),...
158
votes
14
answers
459k
views
Convert stdClass object to array in PHP [duplicate]
I fetch post_id from postmeta as:
$post_id = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE (meta_key = 'mfn-post-link1' AND meta_value = '". $from ."')");
when i try print_r($...
0
votes
2
answers
2k
views
convert data fetched from DB to array in laravel
I fetched data from table 'auction'
$players = DB::table('auction')->where('id',$id)->get();
I'm getting the data in this form
[
{
"id": 3,
"name": "Yogesh Singh",
"year": "BE",
...
0
votes
1
answer
2k
views
How to parse stdClass object in php
Using var_dump from an API call give me the output like this
How to put them into an array? thanks
-1
votes
1
answer
1k
views
convert array to html
I get data array make me confuse like this:
{
"error":0,
"productcount":"1",
"page":1,
"totalpage":1,
"result":[sorry hidden cust request]
}
I want to convert it to html table, how ? ...
-1
votes
4
answers
1k
views
store string with key and value in array
I have a string = "Name":"Susan","Age":"23","Gender":"Male";
How to store them in an array so that I can echo the value for example:
echo $array['Name']
or
echo $array['Age']
Thanks
0
votes
1
answer
1k
views
Passing Stored Procedure result to Laravel API Resource
I wanted to pass the result of the executed stored procedure to my PB.vue
But the problem is, it's giving me an error saying:
Call to a member function first() on array
public function index()
{
...
0
votes
2
answers
955
views
How to return data as JSON in moodle webservices
I am creating a webservice in moodle and want to return my std object as a JSON,
public static function add_attendance_lti($attendanceObject)
{
......
$lti_updated = [
'id' => $...
0
votes
1
answer
1k
views
PHP usort() not working as expected
I have some simple PHP code that formats an object containing information about some songs. I try and sort this information using usort(), but I can't quite get the sorting to work correctly.
print_r(...
0
votes
2
answers
718
views
Cannot use object of type stdClass as array using laravel
I have made function to display all my privileges against the menu.
My controller code is below:
<?php
class PrivilegesController extends Controller
{
public function ...
-2
votes
2
answers
486
views
PHP - reading through multiple object(stdClass) in array
I have a variable, $result, that hold the following:
object(stdClass) #1 (1) { ["response"]= > object(stdClass) #2 (6) {
["status"]= > string(2) "OK"
["count"] => int(1)
["...
4
votes
2
answers
158
views
PHP - Read Json and parse to array
I'm trying to read the returned json below but i keep getting errors.
Cannot use object of type stdClass as array
I'm fetching the json via curl and then json_decode($data);
foreach($array as $a)
{
...
0
votes
1
answer
680
views
"Cannot use object of type stdClass as array" in laravel API resource collection error when using db::paginate()
When I am using laravel Collection & DB query pagination. getting the following error.
new UserCollection(DB::table('users')->paginate());
I am using elequent pagination as follows,
new ...
0
votes
5
answers
148
views
Php changed from Array to Objects
I am using woocommerce 2.6 now on woocommerce 3.0 output of $item->get_items has changed from Array to Objects.
I want to convert object std class to array by key name to fetch data. Below is ...