3v4l.org

run code in 500+ 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:  28
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                                                   'strtolower'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $6      
          5        FRAMELESS_ICALL_3                str_replace         ~7      '+', !1
          6        OP_DATA                                                      $6
          7        ASSIGN                                                       !2, ~7
    7     8        INIT_FCALL                                                   'wordwrap'
          9        INIT_FCALL                                                   'strtolower'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $9      
         12        SEND_VAR                                                     $9
         13        SEND_VAL                                                     1
         14        SEND_VAR                                                     !1
         15        SEND_VAL                                                     0
         16        DO_ICALL                                             $10     
         17        ASSIGN                                                       !3, $10
    9    18        CONCAT                                               ~12     'Original%3A+%09', !0
         19        CONCAT                                               ~13     ~12, '%0A'
         20        ECHO                                                         ~13
   11    21        CONCAT                                               ~14     'str_replace%3A+%09', !2
         22        CONCAT                                               ~15     ~14, '%0A'
         23        ECHO                                                         ~15
   13    24        CONCAT                                               ~16     'wordwrap%3A+%09', !3
         25        CONCAT                                               ~17     ~16, '%0A'
         26        ECHO                                                         ~17
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.74 ms | 2636 KiB | 15 Q