3v4l.org

run code in 500+ PHP versions simultaneously
<?php // the input $input = <<<STR section subsection text STR; // determine initial whitespace length preg_match('/^(?<initial>\s*)/', $input, $match); ['initial' => $initialWhiteSpace] = $match; $whiteSpaceLength = strlen($initialWhiteSpace); // convert string to array of lines $lines = explode(PHP_EOL, $input); // replace the white-space $output = array_map( static fn (string $str): string => preg_replace(sprintf("/^[ \t]{%d}/", $whiteSpaceLength), '', $str), $lines, ); // recreate the string $output = implode(PHP_EOL, $output); echo $output;
Output for git.master, git.master_jit, rfc.property-hooks
section subsection text

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:
53.68 ms | 1253 KiB | 4 Q