3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(!function_exists(cutstringgf)) { function cutstringgf($stranb, $lengthanb, $theend = "... ") { $stranb = strip_tags($stranb); if (strlen($stranb) > 80) { $text2 = substr($stranb, 0, $lengthanb); $words = explode(" ", $text2); $words = array_reverse($words); array_splice($words, 0, 1); $alexxnb = 0; for ($i = 0; $i < count($words); $i++) { $i = $i - $alexxnb; if (substr($words[$i], - 1) == "," or substr($words[$i], - 1) == "." or substr($words[$i], - 1) == ":" or substr($words[$i], - 1) == ";") { $words[$i] = substr($words[$i], 0, strlen($words[$i]) - 1); } ; $wrd = $words[$i]; if (strlen($wrd) < 4) { array_splice($words, $i, 1); $alexxnb = 1; } else { $i = 1985; } ; } ; $mwords = ""; $words = array_reverse($words); for ($i = 0; $i < count($words); $i++) { $mwords = $mwords . $words[$i]; if ($i != count($words) - 1) { $mwords = $mwords . " "; } else { $mwords = $mwords . $theend; } ; } ; } else { $mwords = $stranb; } echo $mwords; } } $txt = $modx->getDocument($iddoc); $source = '<p>Seth Kimbrough стал совсем модненьким, знатоки помнят с каких "диванов" он начинал. Приятно смотреть на его катание в любом обличии. Катается не в напряг и это чувствуется после просмотра любого видео. Эта реклама <a title="shadow" href="brands/shadow_conspiracy_bmx.html" target="_blank">Shadow</a> - не исключение. Здорово!</p> <p>&nbsp;</p>'; echo cutstringgf(stripslashes(preg_replace("/<img(.*?)\>/", "", preg_replace('/<span[^>]*>(.*)<\/span>/Ui', '\\1', $source))), 350); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "cutstringgf" in /in/tikQK:2 Stack trace: #0 {main} thrown in /in/tikQK on line 2
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Warning: Use of undefined constant cutstringgf - assumed 'cutstringgf' (this will throw an Error in a future version of PHP) in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Uncaught Error: Call to a member function getDocument() on null in /in/tikQK:54 Stack trace: #0 {main} thrown in /in/tikQK on line 54
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant cutstringgf - assumed 'cutstringgf' (this will throw an Error in a future version of PHP) in /in/tikQK on line 2 Fatal error: Uncaught Error: Call to a member function getDocument() on null in /in/tikQK:54 Stack trace: #0 {main} thrown in /in/tikQK on line 54
Process exited with code 255.
Output for 7.0.5 - 7.0.20, 7.1.0 - 7.1.20
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Uncaught Error: Call to a member function getDocument() on null in /in/tikQK:54 Stack trace: #0 {main} thrown in /in/tikQK on line 54
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Uncaught Error: Call to a member function getDocument() on unknown in /in/tikQK:54 Stack trace: #0 {main} thrown in /in/tikQK on line 54
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Call to a member function getDocument() on null in /in/tikQK on line 54
Process exited with code 255.
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Call to a member function getDocument() on a non-object in /in/tikQK on line 54
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Notice: Undefined variable: modx in /in/tikQK on line 54 Fatal error: Call to a member function getDocument() on a non-object in /in/tikQK on line 54
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Fatal error: Call to a member function on a non-object in /in/tikQK on line 54
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant cutstringgf - assumed 'cutstringgf' in /in/tikQK on line 2 Fatal error: Call to a member function on a non-object in /in/tikQK on line 54

preferences:
239.58 ms | 402 KiB | 312 Q