fork download
  1. <?php
  2.  
  3. $data = (object) [
  4. "Chats" => [
  5. (object) ["Chat" => (object) ["ChatId" => 1000]],
  6. (object) ["Chat" => (object) ["ChatId" => 2000]],
  7. (object) ["Chat" => (object) ["ChatId" => 3000]],
  8. (object) ["Chat" => (object) ["ChatId" => 4000]],
  9. (object) ["Chat" => (object) ["ChatId" => 5000]],
  10. ]
  11. ];
  12.  
  13. $ChatIds = [];
  14.  
  15. foreach ($data->Chats as $Chat) {
  16. $ChatIds[] = $Chat->Chat->ChatId;
  17. }
  18.  
  19. var_export($ChatIds);
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
array (
  0 => 1000,
  1 => 2000,
  2 => 3000,
  3 => 4000,
  4 => 5000,
)