3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = '2014_10_12_100000_create_password_resets_table'; // Create array of all parts... $steps['explode'] = explode('_', $file); // The expected datetime format as 4 parts, so we remove the first 4 elements and keep the rest. $steps['slice'] = array_slice($steps['explode'], 4); // Implode the remaining elements back together into a snake_case string. $steps['implode'] = implode('_', $steps['slice']); // Convert the snake_case string to a StudlyCase class name. $steps['class'] = studly_case($steps['implode']); var_dump($steps); function studly_case($value) { $value = ucwords(str_replace(['-', '_'], ' ', $value)); return str_replace(' ', '', $value); }
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { ["explode"]=> array(8) { [0]=> string(4) "2014" [1]=> string(2) "10" [2]=> string(2) "12" [3]=> string(6) "100000" [4]=> string(6) "create" [5]=> string(8) "password" [6]=> string(6) "resets" [7]=> string(5) "table" } ["slice"]=> array(4) { [0]=> string(6) "create" [1]=> string(8) "password" [2]=> string(6) "resets" [3]=> string(5) "table" } ["implode"]=> string(28) "create_password_resets_table" ["class"]=> string(25) "CreatePasswordResetsTable" }

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:
33.08 ms | 407 KiB | 5 Q