3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'Odpoštěno'; $s = mb_strtolower($s, 'utf8'); $ln = mb_strlen($s, 'utf8'); $i = 0; do { $b = decbin($i); $p = strrev(str_pad((string) $b, $ln, '0', STR_PAD_LEFT)); $r = ''; for ($j = 0; $j < strlen($p); $j++) { $ch = mb_substr($s, $j, 1, 'utf8'); $r .= $p[$j] ? mb_strtoupper($ch, 'utf8') : $ch; } echo $r . ' '; if ($p === str_repeat('1', $ln)) { break; } $i++; } while (true);

preferences:
36.14 ms | 402 KiB | 5 Q