nadeesha
nadeesha

Reputation: 27

Need to pass array value in to another array

   $dataOrder = [
  'orderid' => date( 'ymdhis' )
   ];


                $details =[

         
                'orderid'=>$dataOrder->orderid



               ];

I need to pass $dataOrder array's orderid value into $details array. And error is "Attempt to read property "orderid" on array". This code is for testing purpose.

Upvotes: 0

Views: 87

Answers (1)

user15216913
user15216913

Reputation:

change $dataOrder->orderid to $dataOrder['orderid']

by the way, you can do this:

$dataOrder = date( 'ymdhis' );

$details = [
      'orderid'=>$dataOrder
 ];

Upvotes: 1

Related Questions