syntax error, unexpected identifier "Object", expecting ")" in php laravel

  php

i have an array in stdClass object like this

$arr = array([0] => stdClass Object ( 
                [User_ID] => 40697 [Completed] => 1 
                [Last_Attempt] => 2021-07-06 11:47:11 
                [Level_Order] => 1 
                [Last_Login] => 2021-08-23 11:58:54 
                [RewardName] => Hidden Hideaway 41: Basketball 
                [Verse_Title] => Romans 6:11–13a (ESV) 
                [SceneID] => 159 
                [Name] => ROMANS, I 
                [Unit_Num] => UNIT 10 
                [Day_Num] => WEEK 1 
                [bonus_group] => 0 
                [holiday_group] => 0 
                )
      [1] => stdClass Object ( 
                [User_ID] => 40697 [Completed] => 1 
                [Last_Attempt] => 2021-07-06 11:47:11 
                [Level_Order] => 1 
                [Last_Login] => 2021-08-23 11:58:54 
                [RewardName] => Hidden Hideaway 41: Basketball 
                [Verse_Title] => Romans 6:11–13a (ESV) 
                [SceneID] => 159 
                [Name] => ROMANS, I 
                [Unit_Num] => UNIT 10 
                [Day_Num] => WEEK 1 
                [bonus_group] => 0 
                [holiday_group] => 0 
                ) 

       );

i want normal array , then i wrote code like this

$myArray = json_decode(json_encode($arr), true);
    dd($myArray);

but i got error

syntax error, unexpected identifier "Object", expecting ")" at line $arr = array([0] => stdClass Object (

whats wrong within it.

Source: Ask PHP

LEAVE A COMMENT