<?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 '_';
You have javascript disabled. You will not be able to edit any code.