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 '_';
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> string(8) "01234567" [1]=> string(6) "create" [2]=> string(6) "mycool" [3]=> string(9) "table.php" } array(0) { } string(0) ""

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
31.58 ms | 405 KiB | 5 Q