Skip to content

Instantly share code, notes, and snippets.

@dozer111
Last active February 18, 2020 13:27
Show Gist options
  • Save dozer111/916283f6ff7f93b63532bd91cc026002 to your computer and use it in GitHub Desktop.
Save dozer111/916283f6ff7f93b63532bd91cc026002 to your computer and use it in GitHub Desktop.
(array)

Наглядный пример, во что переганяются данные через (array)

class X {  
  public $test1 = 'test1';  
 public $test2 = 'test2';  
 public $test3 = 'test3';  
 public $test4 = 'test4';  
}  
  
$test = new X();  
  
$data = [  
  1,  
  'asd',  
  [1,23,4],  
  [],  
 new DateTime(),  
  $test  
];  
  
foreach ($data as $d){  
 dump((array)$d);  
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment