3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Convert spaces to dash and LowerCase with PHP'; $separator = '-'; $str_replace = str_replace(' ', $separator, strtolower($str)); $wordwrap = wordwrap(strtolower($str), 1, $separator, 0); echo 'Original: ' . "\t" . $str . "\n"; echo 'str_replace: ' . "\t" . $str_replace . "\n"; echo 'wordwrap: ' . "\t" . $wordwrap . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X1iVm
function name:  (null)
number of ops:  31
compiled vars:  !0 = $str, !1 = $separator, !2 = $str_replace, !3 = $wordwrap
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Convert+spaces+to+dash+and+LowerCase+with+PHP'
    4     1        ASSIGN                                                   !1, '-'
    6     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !1
          5        INIT_FCALL                                               'strtolower'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
    7    11        INIT_FCALL                                               'wordwrap'
         12        INIT_FCALL                                               'strtolower'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        SEND_VAR                                                 $9
         16        SEND_VAL                                                 1
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 0
         19        DO_ICALL                                         $10     
         20        ASSIGN                                                   !3, $10
    9    21        CONCAT                                           ~12     'Original%3A+%09', !0
         22        CONCAT                                           ~13     ~12, '%0A'
         23        ECHO                                                     ~13
   11    24        CONCAT                                           ~14     'str_replace%3A+%09', !2
         25        CONCAT                                           ~15     ~14, '%0A'
         26        ECHO                                                     ~15
   13    27        CONCAT                                           ~16     'wordwrap%3A+%09', !3
         28        CONCAT                                           ~17     ~16, '%0A'
         29        ECHO                                                     ~17
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.58 ms | 1400 KiB | 19 Q