3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT The answer was within her reach. It was hidden in a box and now that box sat directly in front of her. She'd spent years searching for it and could hardly believe she'd finally managed to find it. She turned the key to unlock the box and then gently lifted the top. She held her breath in anticipation of finally knowing the answer she had spent so much of her time in search of. As the lid came off she could see that the box was empty. TEXT; $offsets = array_keys(str_word_count($text, 2)); $totalPerGroup = intdiv(count($offsets), 10); $chunks = array_chunk($offsets, $totalPerGroup); $starts = array_column($chunks, 0); var_export( array_map( fn($start, $end) => substr($text, $start, $end ? $end - $start : $end), $starts, array_slice($starts, 1) + [null] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tbYMg
function name:  (null)
number of ops:  41
compiled vars:  !0 = $text, !1 = $offsets, !2 = $totalPerGroup, !3 = $chunks, !4 = $starts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'The+answer+was+within+her+reach.+It+was+hidden+in+a+box+and+now+that+box+sat+directly+in+front+of+her.+She%27d+spent+years+searching+for+it+and+could+hardly+believe+she%27d+finally+managed+to+find+it.+She+turned+the+key+to+unlock+the+box+and+then+gently+lifted+the+top.+She+held+her+breath+in+anticipation+of+finally+knowing+the+answer+she+had+spent+so+much+of+her+time+in+search+of.+As+the+lid+came+off+she+could+see+that+the+box+was+empty.'
    7     1        INIT_FCALL                                               'array_keys'
          2        INIT_FCALL                                               'str_word_count'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 2
          5        DO_ICALL                                         $6      
          6        SEND_VAR                                                 $6
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    8     9        INIT_FCALL                                               'intdiv'
         10        COUNT                                            ~9      !1
         11        SEND_VAL                                                 ~9
         12        SEND_VAL                                                 10
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
    9    15        INIT_FCALL                                               'array_chunk'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $12     
         19        ASSIGN                                                   !3, $12
   10    20        INIT_FCALL                                               'array_column'
         21        SEND_VAR                                                 !3
         22        SEND_VAL                                                 0
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !4, $14
   11    25        INIT_FCALL                                               'var_export'
   12    26        INIT_FCALL                                               'array_map'
   13    27        DECLARE_LAMBDA_FUNCTION                          ~16     [0]
         28        BIND_LEXICAL                                             ~16, !0
         29        SEND_VAL                                                 ~16
   14    30        SEND_VAR                                                 !4
   15    31        INIT_FCALL                                               'array_slice'
         32        SEND_VAR                                                 !4
         33        SEND_VAL                                                 1
         34        DO_ICALL                                         $17     
         35        ADD                                              ~18     $17, <array>
         36        SEND_VAL                                                 ~18
   12    37        DO_ICALL                                         $19     
   15    38        SEND_VAR                                                 $19
   11    39        DO_ICALL                                                 
   17    40      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tbYMg
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $start, !1 = $end, !2 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6      > JMPZ                                                     !1, ->10
          7    >   SUB                                              ~3      !1, !0
          8        QM_ASSIGN                                        ~4      ~3
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~4      !1
         11    >   SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
         14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.57 ms | 1012 KiB | 22 Q