3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = "2018-03-22 12:43:21,NM_Test.h264,-2\n"; $idx = strrpos($output, ','); if ($idx !== FALSE) { $code = substr($output, $idx + 1); echo 'Error code: '; var_dump($code); echo 'Error code as number: '; var_dump((int)$code); } else { echo 'Comma is not present in the input string'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ek5tv
function name:  (null)
number of ops:  26
compiled vars:  !0 = $output, !1 = $idx, !2 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2018-03-22+12%3A43%3A21%2CNM_Test.h264%2C-2%0A'
    4     1        INIT_FCALL                                               'strrpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2C'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        TYPE_CHECK                                  1018          !1
          7      > JMPZ                                                     ~6, ->24
    6     8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        ADD                                              ~7      !1, 1
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
    7    14        ECHO                                                     'Error+code%3A+'
    8    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
    9    18        ECHO                                                     'Error+code+as+number%3A+'
   10    19        INIT_FCALL                                               'var_dump'
         20        CAST                                          4  ~11     !2
         21        SEND_VAL                                                 ~11
         22        DO_ICALL                                                 
    5    23      > JMP                                                      ->25
   12    24    >   ECHO                                                     'Comma+is+not+present+in+the+input+string'
   13    25    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
260.88 ms | 1004 KiB | 16 Q