3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $len = 10; echo str_pad('Foo', $len) . '|' . PHP_EOL; echo str_pad('Déja vu', $len) . '|' . PHP_EOL; echo 'Déja vu'.str_repeat(' ', $len - mb_strwidth('Déja vu', mb_detect_encoding('Déja vu'))) . '|';
based on YnC54
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Foo | Déja vu | Déja vu |
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/mqQJJ on line 3 Foo |PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/mqQJJ on line 4 Déja vu |PHP_EOLDéja vu |