3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Deciphering this peculiar line Laravel's Migrator.php - Str::studly(implode('_', array_slice(explode('_', $file), 4))); * * I'm probably being dumb, but I can't for the life of me work out.. * well, how it would ever work. * * https://github.com/laravel/framework/blame/5.5/src/Illuminate/Database/Migrations/Migrator.php#L415 */ $testCase = '01234567_create_mycool_table.php'; // Break in to chunks $testCase = explode('_', $testCase); var_dump($testCase); // Slice... Presumably to take the timestamp off. (So, array_slice($str, 1, 4)... oh?) $testCase = array_slice($testCase, 4); var_dump($testCase); // Implode.. with underscores again. (Surely substr($str, 0, strpos($str, '_')-1) would be easier?) // It doesn't matter, as unless we have a_really_long_file_name; this will be empty anyway.. $testCase = implode('_', $testCase); var_dump($testCase); // Studly converts to camelcase based upon the placement of '_';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sV6e7
function name:  (null)
number of ops:  26
compiled vars:  !0 = $testCase
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, '01234567_create_mycool_table.php'
   16     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '_'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !0, $2
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   20     9        INIT_FCALL                                               'array_slice'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 4
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !0, $5
   21    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
   25    17        INIT_FCALL                                               'implode'
         18        SEND_VAL                                                 '_'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $8      
         21        ASSIGN                                                   !0, $8
   26    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
   28    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.3 ms | 1016 KiB | 17 Q