3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = 'dog.cat' . str_repeat('.dog.cat', 815); for ($i = 0; $i < 5; ++$i) { $txt .= '.dog.cat'; echo count(explode('.', $txt)) . "\n"; echo strlen($txt) . "\n"; if (preg_match("/[a-z]+(?:\.[a-z]+)*/i", $txt, $match)) { echo "A match was found." . strlen($match[0]); } else { echo "A match was not found."; } echo "\n---\n"; }
Output for 7.2.0, 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
1634 6535 A match was found.6535 --- 1636 6543 A match was found.6543 --- 1638 6551 A match was found.6551 --- 1640 6559 A match was found.6559 --- 1642 6567 A match was found.6567 ---
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 1634 6535 A match was found.6535 --- 1636 6543 A match was found.6543 --- 1638 6551 A match was found.6551 --- 1640 6559 A match was found.6559 --- 1642 6567 A match was found.6567 ---

preferences:
72.49 ms | 402 KiB | 28 Q