3v4l.org

run code in 300+ PHP versions simultaneously
<?php $searchQuery = "hello"; $dir = "/home/mosh/"; $files = scandir($dir); foreach($files as $file) { if (($file !== ".") && ($file !== "..")) { $s = file_get_contents($file); preg_match("/{$searchQuery}/",$s,$match); if ($match) { $matchedFiles[] = $file; } } } print_r($matchedFiles);
Output for git.master, git.master_jit
Warning: scandir(): open_basedir restriction in effect. File(/home/mosh/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/qEYgZ on line 4 Warning: scandir(/home/mosh/): Failed to open directory: Operation not permitted in /in/qEYgZ on line 4 Warning: scandir(): (errno 1): Operation not permitted in /in/qEYgZ on line 4 Warning: foreach() argument must be of type array|object, bool given in /in/qEYgZ on line 5 Warning: Undefined variable $matchedFiles in /in/qEYgZ on line 14
Output for rfc.property-hooks
Warning: scandir(): open_basedir restriction in effect. File(/home/mosh/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/qEYgZ on line 4 Warning: scandir(/home/mosh/): Failed to open directory: Operation not permitted in /in/qEYgZ on line 4 Warning: scandir(): (errno 1): Operation not permitted in /in/qEYgZ on line 4 Warning: foreach() argument must be of type array|object, false given in /in/qEYgZ on line 5 Warning: Undefined variable $matchedFiles in /in/qEYgZ on line 14

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:
36.78 ms | 402 KiB | 8 Q