3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_assert($string, $arguments = array()) { // Make sure we don't pass in an empty string. assert('$string !== \'\' && (empty($arguments) || strtr($string, $arguments) !== \'\')', 'empty fail:' . $string); // Make sure we don't translate unnecessarily. assert('empty($arguments) || strtr($string, $arguments) != implode($arguments)', 'unnecesary fail: ' . $string); } test_assert('@test1', ['@test1' => 'test']); test_assert('@test2', ['@test2' => 'test']); test_assert('@test3 foo', ['@test3' => 'test3', '@test_not_used' => 'test']); test_assert('@test4 foo', ['@test4' => 'test4']); test_assert('@test5a@test5b', ['@test5a' => '', '@test5b' => '']); test_assert('');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tkGoR
function name:  (null)
number of ops:  24
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'test_assert'
          1        SEND_VAL                                                 '%40test1'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0          
   11     4        INIT_FCALL                                               'test_assert'
          5        SEND_VAL                                                 '%40test2'
          6        SEND_VAL                                                 <array>
          7        DO_FCALL                                      0          
   12     8        INIT_FCALL                                               'test_assert'
          9        SEND_VAL                                                 '%40test3+foo'
         10        SEND_VAL                                                 <array>
         11        DO_FCALL                                      0          
   13    12        INIT_FCALL                                               'test_assert'
         13        SEND_VAL                                                 '%40test4+foo'
         14        SEND_VAL                                                 <array>
         15        DO_FCALL                                      0          
   14    16        INIT_FCALL                                               'test_assert'
         17        SEND_VAL                                                 '%40test5a%40test5b'
         18        SEND_VAL                                                 <array>
         19        DO_FCALL                                      0          
   15    20        INIT_FCALL                                               'test_assert'
         21        SEND_VAL                                                 ''
         22        DO_FCALL                                      0          
         23      > RETURN                                                   1

Function test_assert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tkGoR
function name:  test_assert
number of ops:  15
compiled vars:  !0 = $string, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    5     2        ASSERT_CHECK                                             
          3        INIT_FCALL                                               'assert'
          4        SEND_VAL                                                 '%24string+%21%3D%3D+%27%27+%26%26+%28empty%28%24arguments%29+%7C%7C+strtr%28%24string%2C+%24arguments%29+%21%3D%3D+%27%27%29'
          5        CONCAT                                           ~2      'empty+fail%3A', !0
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                                 
    7     8        ASSERT_CHECK                                             
          9        INIT_FCALL                                               'assert'
         10        SEND_VAL                                                 'empty%28%24arguments%29+%7C%7C+strtr%28%24string%2C+%24arguments%29+%21%3D+implode%28%24arguments%29'
         11        CONCAT                                           ~4      'unnecesary+fail%3A+', !0
         12        SEND_VAL                                                 ~4
         13        DO_ICALL                                                 
    8    14      > RETURN                                                   null

End of function test_assert

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.94 ms | 1394 KiB | 21 Q