3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "code": "200002 - VALUE_TOO_LONG", "title": "Der von Ihnen gepflegte Wert ist zu lang. K\u00fcrzen Sie die den Wert entsprechend der Zeichenbegrenzung aus der API-Dokumentation.", "path": "\/products", "jsonPath": "$.productVariations[?(@.sku==\"506163\")].productDescription.bulletPoints" }'; $decode = json_decode($json, true); $re = '/\$.productVariations\[.*sku=="(.*)".*].(.*)/m'; preg_match($re, $decode['jsonPath'], $matches); if (!empty($matches)) { $sku = $matches[1]; $field = $matches[2]; } else { $re = '/\$.productVariations\[.*].(.*)/m'; preg_match($re, $decode['jsonPath'], $matches); $sku = '?'; $field = $matches[1]; } var_dump($sku); var_dump($field);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XsYF4
function name:  (null)
number of ops:  38
compiled vars:  !0 = $json, !1 = $decode, !2 = $re, !3 = $matches, !4 = $sku, !5 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%7B%0A++++%22code%22%3A+%22200002+-+VALUE_TOO_LONG%22%2C%0A++++%22title%22%3A+%22Der+von+Ihnen+gepflegte+Wert+ist+zu+lang.+K%5Cu00fcrzen+Sie+die+den+Wert+entsprechend+der+Zeichenbegrenzung+aus+der+API-Dokumentation.%22%2C%0A++++%22path%22%3A+%22%5C%2Fproducts%22%2C%0A++++%22jsonPath%22%3A+%22%24.productVariations%5B%3F%28%40.sku%3D%3D%5C%22506163%5C%22%29%5D.productDescription.bulletPoints%22%0A%7D'
   11     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   13     6        ASSIGN                                                   !2, '%2F%5C%24.productVariations%5C%5B.%2Asku%3D%3D%22%28.%2A%29%22.%2A%5D.%28.%2A%29%2Fm'
   15     7        INIT_FCALL                                               'preg_match'
          8        SEND_VAR                                                 !2
          9        FETCH_DIM_R                                      ~10     !1, 'jsonPath'
         10        SEND_VAL                                                 ~10
         11        SEND_REF                                                 !3
         12        DO_ICALL                                                 
   17    13        ISSET_ISEMPTY_CV                                 ~12     !3
         14        BOOL_NOT                                         ~13     ~12
         15      > JMPZ                                                     ~13, ->21
   18    16    >   FETCH_DIM_R                                      ~14     !3, 1
         17        ASSIGN                                                   !4, ~14
   19    18        FETCH_DIM_R                                      ~16     !3, 2
         19        ASSIGN                                                   !5, ~16
         20      > JMP                                                      ->31
   21    21    >   ASSIGN                                                   !2, '%2F%5C%24.productVariations%5C%5B.%2A%5D.%28.%2A%29%2Fm'
   22    22        INIT_FCALL                                               'preg_match'
         23        SEND_VAR                                                 !2
         24        FETCH_DIM_R                                      ~19     !1, 'jsonPath'
         25        SEND_VAL                                                 ~19
         26        SEND_REF                                                 !3
         27        DO_ICALL                                                 
   23    28        ASSIGN                                                   !4, '%3F'
   24    29        FETCH_DIM_R                                      ~22     !3, 1
         30        ASSIGN                                                   !5, ~22
   27    31    >   INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
   28    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.35 ms | 1400 KiB | 19 Q