3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isObject($value) { return is_object($value) || (is_array($value) && (count($value) == 0 || isAssociativeArray($value))); } function isAssociativeArray($arr) { return array_keys($arr) !== range(0, count($arr) - 1); } function arrayToObjectRecursive($array) { foreach ($array as &$value) { if (is_array($value)) { $value = arrayToObjectRecursive($value); } } return isObject($array) ? (object) $array : $array; } $r = arrayToObjectRecursive([ "appraisalData"=> [ "type"=> "boolean", "description"=> "Valuation data for this product in different conditions" ], "asstNum"=> [ "type"=> "boolean", "description"=> "The assortment number of this product." ], "briefReleaseDesc"=> [ "type"=> "boolean", "description"=> "A brief description of the sku's release history." ], "collectionItems"=> "/api/schema/collect/output.json", "comment"=> [ "type"=> "boolean", "description"=> "Editorial comment for this sku" ], "dateAdded"=> [ "type"=> "boolean", "description"=> "The date this sku was added to the database (timestamp)" ], "description"=> [ "type"=> "boolean", "description"=> "The copy from the packaging" ], "detailsUrl"=> [ "type"=> "boolean", "description"=> "The URL of the details page for this sku" ], "formattedUpc"=> [ "type"=> "boolean", "description"=> "UPC code, with any appropriate hyphens added.", "maxLength"=> 16 ], "fullName"=> [ "type"=> "boolean", "description"=> "A concatenation of the name of the sku, and its variant descriptor" ], "gallery"=> [ "type"=> "object", "description"=> "Choose the photo information you want to get back. Only photos that have been reviewed will be returned.", "additionalProperties"=> false, "properties"=> [ '$ref'=>"/api/schema/photos/output.json" ] ], "groups"=> [ "type"=> "boolean", "description"=> "A list of the groups for this product. Each group contains a list of part ids and the number of times each part appears in that group. For the parts themselves, include 'parts'" ], "inWishlist"=> [ "type"=> "boolean", "description"=> "Returns true if this sku is in the wishlist of the logged-in user, false otherwise." ], "isReleased"=> [ "type"=> "boolean", "description"=> "True if at least one of the release is not upcoming." ], "itemNum"=> [ "type"=> "boolean", "description"=> "Item number of this sku." ], "limited"=> [ "type"=> "boolean", "description"=> "The number of items this sku was limited to" ], "manufacturer"=> [ "type"=> "boolean", "description"=> "The manufacturer of this sku" ], "modifyUrl"=> [ "type"=> "boolean", "description"=> "The URL of the modiy page for this sku" ], "mods"=> [ "type"=> [ "number", "boolean" ], "description"=> "The uid of a shmax user. If this user has any submissions pending for this sku, then information detailing his changes will be returned" ], "name"=> [ "type"=> "boolean", "description"=> "The name of the sku" ], "nameSort"=> [ "type"=> "boolean", "description"=> "The internal string used when sorting by name. Not to be exposed to user." ], "numCollected"=> [ "type"=> "boolean", "description"=> "The number of times this product appears in the collections of shmax users" ], "package"=> [ "type"=> "boolean", "description"=> "The pacakaging this sku came in." ], "parts"=> [ "description"=>"Specify the part information you'd like to get back.", "type"=>"object", "properties"=> [ '$ref'=> "/api/schema/parts/output.json" ] ], "photoBack"=> [ "type"=>"object", "description"=>"Information about the back photo", "properties"=>[ '$ref'=> "/api/schema/photos/output.json" ] ], "photoFront"=> [ "type"=>"object", "description"=>"Information about the front photo", "properties"=>[ '$ref'=> "/api/schema/photos/output.json" ] ], "productId"=> [ "type"=> "boolean", "description"=> "The branding product prefix number, if any. Common with Japanese toys." ], "productIdClean"=> [ "type"=> "boolean", "description"=> "The internal, minimized, sort-friendly version of the product id. Not to be exposed to user." ], "releaseDateKnown"=> [ "type"=> "boolean", "description"=> "True if at least one of the release dates is fully resolved (ie. has year, month and date filled-in)" ], "releases"=> [ '$ref'=> "/api/schema/releases/output.json" ], "relevance"=> [ "type"=> "boolean", "description"=> "A score when doing a full text search." ], "skuId"=> [ "type"=> "boolean", "description"=> "Unique numeric identifier for the sku." ], "skutoylines" => [ "type" => ["object","boolean"], "description" => "Specify the proeprties of each skutoyline you'd like to get back (or false for nothing)", "properties"=>[ '$ref'=>"/api/schema/skutoylines/output.json" ] ], "status"=> [ "type"=> "boolean", "description"=> "Whether the sku is live on the site, or still waiting for a reviewer to approve its creation." ], "stores"=> [ "type"=> "boolean", "description"=> "A list of ids of the stores this product is exclusive to." ], "submitter"=> [ '$ref'=> "/api/schema/users/output.json" ], "upc"=> [ "type"=> "boolean", "description"=> "Universal Product code of this sku" ], "values"=> [ "type"=> "boolean", "description"=> "Appraisal data for this sku." ], "variantDesc"=> [ "type"=> "boolean", "description"=> "A concatenation of the name of the sku, and its variant descriptor" ], "variantDesc"=> [ "type"=> "boolean", "description"=> "Variant descriptor" ], "variantOf"=> [ "type"=> "boolean", "description"=> "Id of the sku that this sku is a variant of" ], "version"=> [ "type"=> "boolean", "description"=> "An integer version. Incremented each time the sku is updated." ], "vitals"=> [ "type"=> "boolean", "description"=> "The dynamically-generated search keywords for this sku. For debugging only." ], "reissueOf"=>[ "description"=>"Specify the information you will get back for the sku that this sku is a reissue of", "properties"=>[ '$ref'=>"/api/schema/skus/output.json" ] ], "reissues"=>[ "description"=>"Specify the information you will get back for the skus that reissues of this sku", "properties"=>[ '$ref'=>"/api/schema/skus/output.json" ] ], "variantOf"=>[ "description"=>"Specify the information you will get back for the sku that this sku is a variant of", "properties"=>[ '$ref'=>"/api/schema/skus/output.json" ] ], "variants"=>[ "description"=>"Specify the information you will get back for the skus that variants of this sku", "properties"=>[ '$ref'=>"/api/schema/skus/output.json" ] ] ]); var_export($r);

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xe9Mh
function name:  (null)
number of ops:  8
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'arraytoobjectrecursive'
   26     1        SEND_VAL                                                 <array>
   24     2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
  237     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function isobject:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 13
Branch analysis from position: 14
filename:       /in/Xe9Mh
function name:  isObject
number of ops:  16
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    5     1        TYPE_CHECK                                  256  ~1      !0
          2      > JMPNZ_EX                                         ~1      ~1, ->14
    6     3    >   TYPE_CHECK                                  128  ~2      !0
          4      > JMPZ_EX                                          ~2      ~2, ->13
          5    >   COUNT                                            ~3      !0
          6        IS_EQUAL                                         ~4      ~3, 0
          7      > JMPNZ_EX                                         ~4      ~4, ->12
          8    >   INIT_FCALL_BY_NAME                                       'isAssociativeArray'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $5      
         11        BOOL                                             ~4      $5
         12    >   BOOL                                             ~2      ~4
         13    >   BOOL                                             ~1      ~2
         14    > > RETURN                                                   ~1
    7    15*     > RETURN                                                   null

End of function isobject

Function isassociativearray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xe9Mh
function name:  isAssociativeArray
number of ops:  13
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 0
          6        COUNT                                            ~2      !0
          7        SUB                                              ~3      ~2, 1
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10        IS_NOT_IDENTICAL                                 ~5      $1, $4
         11      > RETURN                                                   ~5
   12    12*     > RETURN                                                   null

End of function isassociativearray

Function arraytoobjectrecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/Xe9Mh
function name:  arrayToObjectRecursive
number of ops:  21
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1      > FE_RESET_RW                                      $2      !0, ->10
          2    > > FE_FETCH_RW                                              $2, !1, ->10
   17     3    >   TYPE_CHECK                                  128          !1
          4      > JMPZ                                                     ~3, ->9
   18     5    >   INIT_FCALL_BY_NAME                                       'arrayToObjectRecursive'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !1, $4
   16     9    > > JMP                                                      ->2
         10    >   FE_FREE                                                  $2
   21    11        INIT_FCALL                                               'isobject'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $6      
         14      > JMPZ                                                     $6, ->18
         15    >   CAST                                          8  ~7      !0
         16        QM_ASSIGN                                        ~8      ~7
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~8      !0
         19    > > RETURN                                                   ~8
   22    20*     > RETURN                                                   null

End of function arraytoobjectrecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.89 ms | 1007 KiB | 18 Q