3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'id' => '4c44c3e074ffc928250576cc', 'name' => 'Salvation Army', 'contact' => array( 'phone' => '2122899617', 'formattedPhone' => '(212) 289-9617' ), 'location' => array ( 'address' => '26 E 125th St', 'crossStreet' => 'btw Madison & 5th Ave', 'lat' => '40.805853703834', 'lng' => '-73.941053819056', 'distance' => '53', 'postalCode' => '10035', 'cc' => 'US', 'city' => 'New York', 'state' => 'NY', 'country' => 'United States' ), 'categories' => Array ( [ 'id' => '4bf58dd8d48988d101951735', 'name' => 'Thrift / Vintage Store', 'pluralName' => 'Thrift / Vintage Stores', 'shortName' => 'Thrift / Vintage', 'icon' => array ( 'prefix' => 'https://ss1.4sqi.net/img/categories_v2/shops/default_', 'suffix' => '.png' ), 'primary' => '1', ] ), 'verified' => '', 'restricted' => '1', 'stats' => array ( 'checkinsCount' => '71', 'usersCount' => '46', 'tipCount' => '3' ), 'specials' => array ( 'count' => '0', 'items' => Array() ), 'hereNow' => array ( 'count' => '0', 'groups' => Array() ), 'referralId' => 'v-1393405742' ); class Venue { protected $id; protected $categories; protected $contact; protected $fourSquareVenueId; protected $location; protected $name; protected $statistics; public function __construct() { $this->categories = []; } /** * Get id * * @return id $id */ public function getId() { return $this->id; } /** * Add category * * @param \Trist\Bundle\CommonBundle\Document\Venue\VenueCategory $category */ public function addCategory( $category) { $this->categories[] = $category; } /** * Remove category * * @param \Trist\Bundle\CommonBundle\Document\Venue\VenueCategory $category */ public function removeCategory($category) { $this->categories->removeElement($category); } /** * Get categories * * @return \Doctrine\Common\Collections\ArrayCollection $categories */ public function getCategories() { return $this->categories; } /** * Set contact * * @param \Trist\Bundle\CommonBundle\Document\Venue\VenueContact $contact * @return self */ public function setContact($contact) { $this->contact = $contact; return $this; } } $obj = json_decode(json_encode($arr)); /* $obj= new stdClass(); foreach ($arr as $k=> $v) { $obj->{$k} = $v; } */ print_r((new ReflectionObject(new Venue))->getMethods());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  (null)
number of ops:  19
compiled vars:  !0 = $arr, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
  131     1        INIT_FCALL                                               'json_decode'
          2        INIT_FCALL                                               'json_encode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
  140     8        INIT_FCALL                                               'print_r'
          9        NEW                                              $6      'ReflectionObject'
         10        NEW                                              $7      'Venue'
         11        DO_FCALL                                      0          
         12        SEND_VAR_NO_REF_EX                                       $7
         13        DO_FCALL                                      0          
         14        INIT_METHOD_CALL                                         $6, 'getMethods'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Venue:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     0  E >   ASSIGN_OBJ                                               'categories'
          1        OP_DATA                                                  <array>
   75     2      > RETURN                                                   null

End of function __construct

Function getid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  getId
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   84     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1      > RETURN                                                   ~0
   85     2*     > RETURN                                                   null

End of function getid

Function addcategory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  addCategory
number of ops:  5
compiled vars:  !0 = $category
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   RECV                                             !0      
   94     1        FETCH_OBJ_W                                      $1      'categories'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
   95     4      > RETURN                                                   null

End of function addcategory

Function removecategory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  removeCategory
number of ops:  6
compiled vars:  !0 = $category
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   RECV                                             !0      
  104     1        FETCH_OBJ_R                                      ~1      'categories'
          2        INIT_METHOD_CALL                                         ~1, 'removeElement'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
  105     5      > RETURN                                                   null

End of function removecategory

Function getcategories:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  getCategories
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  114     0  E >   FETCH_OBJ_R                                      ~0      'categories'
          1      > RETURN                                                   ~0
  115     2*     > RETURN                                                   null

End of function getcategories

Function setcontact:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNPFr
function name:  setContact
number of ops:  6
compiled vars:  !0 = $contact
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  123     0  E >   RECV                                             !0      
  125     1        ASSIGN_OBJ                                               'contact'
          2        OP_DATA                                                  !0
  126     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
  127     5*     > RETURN                                                   null

End of function setcontact

End of class Venue.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.4 ms | 1392 KiB | 19 Q