3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = 'Sentence number one. Sentence number two. Sentence number 3. Sentence number 4. Sentence number 5.'; $last = strrpos($content, '. '); $parts = str_split($content, strrpos($content, '. ', $last - strlen($content))+2); echo 'First part: ', $parts[0], PHP_EOL, 'Second part: ', $parts[1];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/llnJn
function name:  (null)
number of ops:  27
compiled vars:  !0 = $content, !1 = $last, !2 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Sentence+number+one.+Sentence+number+two.+Sentence+number+3.+Sentence+number+4.+Sentence+number+5.'
    4     1        INIT_FCALL                                               'strrpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '.+'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        INIT_FCALL                                               'str_split'
          7        SEND_VAR                                                 !0
          8        INIT_FCALL                                               'strrpos'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 '.+'
         11        STRLEN                                           ~6      !0
         12        SUB                                              ~7      !1, ~6
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        ADD                                              ~9      $8, 2
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                         $10     
         18        ASSIGN                                                   !2, $10
    7    19        ECHO                                                     'First+part%3A+'
         20        FETCH_DIM_R                                      ~12     !2, 0
         21        ECHO                                                     ~12
         22        ECHO                                                     '%0A'
         23        ECHO                                                     'Second+part%3A+'
         24        FETCH_DIM_R                                      ~13     !2, 1
         25        ECHO                                                     ~13
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.76 ms | 1011 KiB | 15 Q