3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (interface_exists('JsonSerializable', true) === false) { interface JsonSerializable { /** * (PHP 5 &gt;= 5.4.0)<br/> * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. */ function jsonSerialize (); } } /** * @package MXO_JSON */ abstract class MXO_JSON_Collection implements Countable, ArrayAccess, IteratorAggregate, JsonSerializable { protected $container = array(); public function __construct(array $init_array = array()) { $this->container = $init_array; } public function count() { return count($this->container); } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) === true ? $this->container[$offset] : null; } public function getIterator() { return new ArrayIterator($this->container); } public function __clone() { $this->container = MXO_JSON::copy($this->container); } /** * returns result in raw format - for use with php's array functions * * @deprecated If you need this, consider adding more array-specific functions to MXO_JSON_Utils */ public function getRaw() { $result = array(); foreach ($this->container as $key => $element) { if ($element instanceof MXO_JSON_Collection) { $result[$key] = $element->getRaw(); } else { $result[$key] = $element; } } return $result; } /** * Like getRaw, but only converts this collection to an array; * deeper collections are left as-is. * * @deprecated If you need this, consider adding more array-specific functions to MXO_JSON_Utils */ public function getAsArray() { return $this->container; } public function keyExists($key) { return array_key_exists($key, $this->container); } public function keys() { return array_keys($this->container); } public function values() { return array_values($this->container); } public function sort($sort_flags = null) { return sort($this->container, $sort_flags); } public function rsort($sort_flags = null) { return rsort($this->container, $sort_flags); } abstract public function natsort(); abstract public function natcasesort(); public function usort($value_compare_func) { return usort($this->container, $value_compare_func); } abstract public function map($callback); abstract public function filter($callback); abstract public function merge($obj); public function search($needle) { return array_search($needle, $this->container, true); } abstract public function intersect($obj); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/F7pSJ
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'interface_exists'
          1        SEND_VAL                                                 'JsonSerializable'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $0      
          4        TYPE_CHECK                                    4          $0
          5      > JMPZ                                                     ~1, ->7
    4     6    >   DECLARE_CLASS                                            'jsonserializable'
   19     7    >   DECLARE_CLASS                                            'mxo_json_collection'
  112     8      > RETURN                                                   1

Class JsonSerializable:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  jsonSerialize
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   null

End of function jsonserialize

End of class JsonSerializable.

Class MXO_JSON_Collection:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $init_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV_INIT                                        !0      <array>
   23     1        ASSIGN_OBJ                                               'container'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function __construct

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  count
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'container'
          1        COUNT                                            ~1      ~0
          2      > RETURN                                                   ~1
   28     3*     > RETURN                                                   null

End of function count

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  offsetExists
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        FETCH_OBJ_IS                                     ~1      'container'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3      > RETURN                                                   ~2
   32     4*     > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  offsetGet
number of ops:  12
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   35     1        FETCH_OBJ_IS                                     ~1      'container'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        TYPE_CHECK                                    8          ~2
          4      > JMPZ                                                     ~3, ->9
          5    >   FETCH_OBJ_R                                      ~4      'container'
          6        FETCH_DIM_R                                      ~5      ~4, !0
          7        QM_ASSIGN                                        ~6      ~5
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~6      null
         10    > > RETURN                                                   ~6
   36    11*     > RETURN                                                   null

End of function offsetget

Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  getIterator
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $0      'ArrayIterator'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $1      'container'
          3        SEND_FUNC_ARG                                            $1
          4        DO_FCALL                                      0          
          5      > RETURN                                                   $0
   40     6*     > RETURN                                                   null

End of function getiterator

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  __clone
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_STATIC_METHOD_CALL                                  'MXO_JSON', 'copy'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $1      'container'
          3        SEND_FUNC_ARG                                            $1
          4        DO_FCALL                                      0  $2      
          5        ASSIGN_OBJ                                               'container'
          6        OP_DATA                                                  $2
   44     7      > RETURN                                                   null

End of function __clone

Function getraw:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/F7pSJ
function name:  getRaw
number of ops:  18
compiled vars:  !0 = $result, !1 = $element, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   ASSIGN                                                   !0, <array>
   53     1        FETCH_OBJ_R                                      ~4      'container'
          2      > FE_RESET_R                                       $5      ~4, ->15
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->15
          4    >   ASSIGN                                                   !2, ~6
   54     5        INSTANCEOF                                               !1, 'MXO_JSON_Collection'
          6      > JMPZ                                                     ~8, ->12
   55     7    >   INIT_METHOD_CALL                                         !1, 'getRaw'
          8        DO_FCALL                                      0  $10     
          9        ASSIGN_DIM                                               !0, !2
         10        OP_DATA                                                  $10
         11      > JMP                                                      ->14
   57    12    >   ASSIGN_DIM                                               !0, !2
         13        OP_DATA                                                  !1
   53    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $5
   60    16      > RETURN                                                   !0
   61    17*     > RETURN                                                   null

End of function getraw

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

End of function getasarray

Function keyexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  keyExists
number of ops:  5
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   73     0  E >   RECV                                             !0      
   74     1        FETCH_OBJ_R                                      ~1      'container'
          2        ARRAY_KEY_EXISTS                                 ~2      !0, ~1
          3      > RETURN                                                   ~2
   75     4*     > RETURN                                                   null

End of function keyexists

Function keys:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  keys
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   78     0  E >   INIT_FCALL                                               'array_keys'
          1        FETCH_OBJ_R                                      ~0      'container'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   79     5*     > RETURN                                                   null

End of function keys

Function values:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  values
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   INIT_FCALL                                               'array_values'
          1        FETCH_OBJ_R                                      ~0      'container'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   83     5*     > RETURN                                                   null

End of function values

Function sort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  sort
number of ops:  8
compiled vars:  !0 = $sort_flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     0  E >   RECV_INIT                                        !0      null
   86     1        INIT_FCALL                                               'sort'
          2        FETCH_OBJ_W                                      $1      'container'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   87     7*     > RETURN                                                   null

End of function sort

Function rsort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  rsort
number of ops:  8
compiled vars:  !0 = $sort_flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   89     0  E >   RECV_INIT                                        !0      null
   90     1        INIT_FCALL                                               'rsort'
          2        FETCH_OBJ_W                                      $1      'container'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   91     7*     > RETURN                                                   null

End of function rsort

Function natsort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  natsort
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E > > RETURN                                                   null

End of function natsort

Function natcasesort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  natcasesort
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E > > RETURN                                                   null

End of function natcasesort

Function usort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  usort
number of ops:  8
compiled vars:  !0 = $value_compare_func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   97     0  E >   RECV                                             !0      
   98     1        INIT_FCALL                                               'usort'
          2        FETCH_OBJ_W                                      $1      'container'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   99     7*     > RETURN                                                   null

End of function usort

Function map:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  map
number of ops:  2
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  101     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function map

Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  filter
number of ops:  2
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  103     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function filter

Function merge:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  merge
number of ops:  2
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  105     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function merge

Function search:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  search
number of ops:  9
compiled vars:  !0 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  107     0  E >   RECV                                             !0      
  108     1        INIT_FCALL                                               'array_search'
          2        SEND_VAR                                                 !0
          3        FETCH_OBJ_R                                      ~1      'container'
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
  109     8*     > RETURN                                                   null

End of function search

Function intersect:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F7pSJ
function name:  intersect
number of ops:  2
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  111     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function intersect

End of class MXO_JSON_Collection.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.22 ms | 1416 KiB | 27 Q