3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dir = '/tmp/'.uniqid(); mkdir($dir); mkdir($dir.'/Source'); mkdir($dir.'/A'); mkdir($dir.'/B'); mkdir($dir.'/C'); file_put_contents($dir.'/Source/file', 'foo'); file_put_contents($dir.'/A/file', 'bar'); file_put_contents($dir.'/B/file', 'bar'); file_put_contents($dir.'/C/file', 'bar'); $perm_writable = 0777; $perm_not_writable = 0555; chmod($dir.'/A/file', $perm_writable); chmod($dir.'/A', $perm_writable); chmod($dir.'/B/file', $perm_not_writable); chmod($dir.'/B', $perm_writable); chmod($dir.'/C/file', $perm_writable); chmod($dir.'/C', $perm_not_writable); exec('tree '.$dir, $output); print_r($output); var_dump(rename($dir.'/Source/file', $dir.'/A/file')); var_dump(rename($dir.'/Source/file', $dir.'/B/file')); var_dump(rename($dir.'/Source/file', $dir.'/C/file'));

preferences:
39.1 ms | 402 KiB | 5 Q