3v4l.org

run code in 300+ PHP versions simultaneously
<?php function arrayToUpper($array) { return mb_strtoupper($array[0], 'UTF-8'); } function arrayToLower($array) { return mb_strtolower($array[0], 'UTF-8'); } $address_l1 = 'Ul. Tadeusza Zawadzkiego "zośki" 59/11'; //zamieniamy znaki specjalne (tabulator, enter) na spację $first_upper = preg_replace('/([\n\r\t])/ui', ' ', trim($address_l1)); //ciąg więcej niż jedna spacja zamieniamy na jedną spację $first_upper = preg_replace('/([ ]{2,})/ui', ' ', $first_upper); //wycinamy spacje po kropkach... $first_upper = preg_replace('/(\.[ ]+)/ui', '.', $first_upper); //i wstawiamy po kropce zawsze jedną spację $first_upper = preg_replace('/(\.)/ui', '. ', $first_upper); //pierwsze litery wielkie $first_upper = mb_convert_case($first_upper, MB_CASE_TITLE, 'UTF-8'); //liczby rzymskie muszą być wszystkie wielkimi (bierzemy tylko pod uwagę liczby ze znakami I, V, X) $first_upper = preg_replace_callback('/([ \.]+[IVX-]{2,})/ui', 'arrayToUpper', " ".$first_upper); //po apostrofie mała litera $first_upper = preg_replace_callback('/([\'`].)/ui', 'arrayToLower', $first_upper); //po ukośniku duża litera litera $first_upper = preg_replace_callback('/([\/].)/ui', array(&$this, 'arrayToUpper'), $first_upper); //obcinamy spacje na początku i końcu $first_upper = trim($first_upper); var_dump($first_upper);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Using $this when not in object context in /in/d9303:34 Stack trace: #0 {main} thrown in /in/d9303 on line 34
Process exited with code 255.

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:
51.02 ms | 401 KiB | 8 Q