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[?(@.scu==\"506163\")].productDescription.bulletPoints" }'; $decode = json_decode($json, true); $re = '/\$.productVariations\[.*sku=="(.*)".*].(.*)/m'; preg_match($re, $decode['jsonPath'], $matches); if (!empty($matches)) { var_dump($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 = 24
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DAhOA
function name:  (null)
number of ops:  41
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.scu%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, ->24
   18    16    >   INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
   19    19        FETCH_DIM_R                                      ~15     !3, 1
         20        ASSIGN                                                   !4, ~15
   20    21        FETCH_DIM_R                                      ~17     !3, 2
         22        ASSIGN                                                   !5, ~17
         23      > JMP                                                      ->34
   22    24    >   ASSIGN                                                   !2, '%2F%5C%24.productVariations%5C%5B.%2A%5D.%28.%2A%29%2Fm'
   23    25        INIT_FCALL                                               'preg_match'
         26        SEND_VAR                                                 !2
         27        FETCH_DIM_R                                      ~20     !1, 'jsonPath'
         28        SEND_VAL                                                 ~20
         29        SEND_REF                                                 !3
         30        DO_ICALL                                                 
   24    31        ASSIGN                                                   !4, '%3F'
   25    32        FETCH_DIM_R                                      ~23     !3, 1
         33        ASSIGN                                                   !5, ~23
   28    34    >   INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                                 
   29    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.71 ms | 1400 KiB | 19 Q