3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = "Αυτή είναι η 1η δοκιμασία. Πρέπει να την ολοκληρώσω. Ώστε να μου δώσουν την 2η δοκιμασία. Και τέλος, την 3η δοκιμασία." ; $res = preg_split( "/(.*?\.*?)\../", $test, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); var_dump($res); $wordcounts = array_map(function ($item) { return count(preg_split('/\s+/', $item)); }, $res); var_dump($wordcounts);
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14, 8.4.16, 8.5.0 - 8.5.1
Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in /in/JNBYX on line 4 array(4) { [0]=> string(45) "Αυτή είναι η 1η δοκιμασία" [1]=> string(45) "Πρέπει να την ολοκληρώσω" [2]=> string(63) "Ώστε να μου δώσουν την 2η δοκιμασία" [3]=> string(49) "Και τέλος, την 3η δοκιμασία." } array(4) { [0]=> int(5) [1]=> int(4) [2]=> int(7) [3]=> int(5) }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.3.28
/bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28)
Process exited with code 1.
Output for 8.1.0 - 8.1.33
Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in /in/JNBYX on line 8 array(4) { [0]=> string(45) "Αυτή είναι η 1η δοκιμασία" [1]=> string(45) "Πρέπει να την ολοκληρώσω" [2]=> string(63) "Ώστε να μου δώσουν την 2η δοκιμασία" [3]=> string(49) "Και τέλος, την 3η δοκιμασία." } array(4) { [0]=> int(5) [1]=> int(4) [2]=> int(7) [3]=> int(5) }
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
array(4) { [0]=> string(45) "Αυτή είναι η 1η δοκιμασία" [1]=> string(45) "Πρέπει να την ολοκληρώσω" [2]=> string(63) "Ώστε να μου δώσουν την 2η δοκιμασία" [3]=> string(49) "Και τέλος, την 3η δοκιμασία." } array(4) { [0]=> int(5) [1]=> int(4) [2]=> int(7) [3]=> int(5) }

preferences:
205.06 ms | 413 KiB | 5 Q