3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tests = [ "On", "Off" ]; foreach ($tests as $test) { $result = [ "test" => $test, "boolval" => boolval($test), "FILTER_VALIDATE_BOOLEAN" => filter_var($test, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ]; $result["agreement"] = $result["boolval"] === $result["FILTER_VALIDATE_BOOLEAN"]; echo json_encode($result, JSON_PRETTY_PRINT), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 25
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/bOrhG
function name:  (null)
number of ops:  27
compiled vars:  !0 = $tests, !1 = $test, !2 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    6     1      > FE_RESET_R                                           $4      !0, ->25
          2    > > FE_FETCH_R                                                   $4, !1, ->25
    8     3    >   INIT_ARRAY                                           ~5      !1, 'test'
    9     4        BOOL                                                 ~6      !1
          5        ADD_ARRAY_ELEMENT                                    ~5      ~6, 'boolval'
   10     6        INIT_FCALL                                                   'filter_var'
          7        SEND_VAR                                                     !1
          8        SEND_VAL                                                     258
          9        SEND_VAL                                                     134217728
         10        DO_ICALL                                             $7      
         11        ADD_ARRAY_ELEMENT                                    ~5      $7, 'FILTER_VALIDATE_BOOLEAN'
    7    12        ASSIGN                                                       !2, ~5
   12    13        FETCH_DIM_R                                          ~10     !2, 'boolval'
         14        FETCH_DIM_R                                          ~11     !2, 'FILTER_VALIDATE_BOOLEAN'
         15        IS_IDENTICAL                                         ~12     ~10, ~11
         16        ASSIGN_DIM                                                   !2, 'agreement'
         17        OP_DATA                                                      ~12
   13    18        INIT_FCALL                                                   'json_encode'
         19        SEND_VAR                                                     !2
         20        SEND_VAL                                                     128
         21        DO_ICALL                                             $13     
         22        ECHO                                                         $13
         23        ECHO                                                         '%0A'
    6    24      > JMP                                                          ->2
         25    >   FE_FREE                                                      $4
   14    26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.3 ms | 3357 KiB | 15 Q