3v4l.org

run code in 300+ PHP versions simultaneously
<?php $trigger_data = "all:ticket_location:is:5|||all:ticket_sub_location:is:1|||any:ticket_is:created:NULL|||any:ticket_is:updated:NULL|||action:assigned_agent_uid:admin"; $final = array(); foreach(explode('|||', $trigger_data) as $e) { $e = explode(':', $e); $result = &$final; $value = end($e); foreach($e as $parts) { if($value === $parts) { $result = $value; } else { $result = &$result[$parts]; } } } print_r($final);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/lJm8P
function name:  (null)
number of ops:  34
compiled vars:  !0 = $trigger_data, !1 = $final, !2 = $e, !3 = $result, !4 = $value, !5 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'all%3Aticket_location%3Ais%3A5%7C%7C%7Call%3Aticket_sub_location%3Ais%3A1%7C%7C%7Cany%3Aticket_is%3Acreated%3ANULL%7C%7C%7Cany%3Aticket_is%3Aupdated%3ANULL%7C%7C%7Caction%3Aassigned_agent_uid%3Aadmin'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%7C%7C%7C'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6      > FE_RESET_R                                       $9      $8, ->29
          7    > > FE_FETCH_R                                               $9, !2, ->29
    6     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%3A'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !2, $10
    7    13        ASSIGN_REF                                               !3, !1
    8    14        INIT_FCALL                                               'end'
         15        SEND_REF                                                 !2
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !4, $13
    9    18      > FE_RESET_R                                       $15     !2, ->27
         19    > > FE_FETCH_R                                               $15, !5, ->27
   10    20    >   IS_IDENTICAL                                             !4, !5
         21      > JMPZ                                                     ~16, ->24
   11    22    >   ASSIGN                                                   !3, !4
         23      > JMP                                                      ->26
   13    24    >   FETCH_DIM_W                                      $18     !3, !5
         25        ASSIGN_REF                                               !3, $18
    9    26    > > JMP                                                      ->19
         27    >   FE_FREE                                                  $15
    5    28      > JMP                                                      ->7
         29    >   FE_FREE                                                  $9
   19    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.23 ms | 948 KiB | 20 Q