Guest User

Untitled

a guest
Mar 22nd, 2017
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. error_reporting(-1);
  3. ini_set('display_errors', 'On');
  4. mb_internal_encoding('utf-8');
  5.  
  6. function getData(){
  7.     $data = '[{
  8.       "firstName": "Иван",
  9.       "lastName": "Иванов",
  10.       "address": "г.Москва, ул. Алиева,2",
  11.       "phoneNumber": "812 143-2534"
  12.     }, {
  13.       "firstName": "Вася",
  14.       "lastName": "Пупкин",
  15.       "address": "г.Воронеж, ул. Пушкина,11",
  16.       "phoneNumber": "812 123-1234"
  17.     }, {
  18.       "firstName": "Сергей",
  19.       "lastName": "Попов",
  20.       "address": "г.Пермь, ул. Савина,30",
  21.       "phoneNumber": "812 321-1444"
  22.     }]';
  23.    
  24.     return $data;
  25. }
  26.  
  27. $decode = file_get_contents(getData());
  28. $decode2 = json_decode($decode);
  29.  
  30. echo '<pre>';
  31. var_dump($decode2);
  32. echo '</pre>';
RAW Paste Data