3v4l.org

run code in 300+ PHP versions simultaneously
<?php function abc($file) { $perms = fileperms($file); if (($perms & 0xC000) == 0xC000) { // Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { // Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { // Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { // Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { // Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { // Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { // FIFO pipe $info = 'p'; } else { // Unknown $info = 'u'; } // Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return posix_getpwuid(fileowner($file))['name'].' '.posix_getpwuid(filegroup($file))['name'].' '.$info; } echo posix_getpwuid(posix_geteuid())['name'].PHP_EOL.PHP_EOL; $d = '.'; foreach(scandir($d) as $dir) { //echo $dir.': '.substr(sprintf('%o', fileperms($dir)), -4).PHP_EOL; echo $dir.' '.abc($d.'/'.$dir).PHP_EOL; }
Output for git.master, git.master_jit
Warning: Trying to access array offset on value of type bool in /in/BM3le on line 55 Warning: scandir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/BM3le on line 57 Warning: scandir(.): Failed to open directory: Operation not permitted in /in/BM3le on line 57 Warning: scandir(): (errno 1): Operation not permitted in /in/BM3le on line 57 Warning: foreach() argument must be of type array|object, bool given in /in/BM3le on line 57
Output for rfc.property-hooks
Warning: Trying to access array offset on false in /in/BM3le on line 55 Warning: scandir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/BM3le on line 57 Warning: scandir(.): Failed to open directory: Operation not permitted in /in/BM3le on line 57 Warning: scandir(): (errno 1): Operation not permitted in /in/BM3le on line 57 Warning: foreach() argument must be of type array|object, false given in /in/BM3le on line 57

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.34 ms | 402 KiB | 8 Q