3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function pnl(string $string){ print($string . PHP_EOL . PHP_EOL); } $paragraph = <<<PARA Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. PARA; $a = substr($paragraph,15,12); pnl('Sub String:'); pnl($a); $last20 = substr($paragraph, -20, 20); $b = strpos($paragraph, 'simply'); pnl('Starting postion of first simply: ' . $b); $last = strrpos($paragraph, 'Lorem'); pnl('Starting postion of last Lorem: ' . $last); $c = stripos($paragraph,'SImpLY'); pnl('Starting postion of first SImpLY (case insensative): ' . $c); $d = strstr($paragraph, 'simply'); pnl('String String:'); pnl($d); $e = str_replace('Lorem Ipsum', 'Heyyy', $paragraph); pnl('Replacing Strings:'); pnl($e); $f = str_ireplace('HEYYY', 'Oh', $e); pnl('Replacing Strings Case Insensitive:'); pnl($f); $g = strlen($paragraph); pnl('Length of the whole paragraph: ' . $g); $startPos = stripos($paragraph,'SpeCimen'); $len = $g - $startPos; $mystrstr = substr($paragraph, $startPos, $len); pnl('My Own strstr:'); pnl($mystrstr); $lenLast = $g - $last; $llo = substr($paragraph, $last, $lenLast); $lloo = substr($paragraph, 0 - $lenLast, $lenLast); pnl('Last Lorem Onwards:'); pnl($llo); pnl('or:'); pnl($lloo); $firstSpaceInLlo = strpos($llo, ' '); $justLastLorem = substr($llo, 0, $firstSpaceInLlo); pnl('Just the last lorem (diff way?):'); pnl($justLastLorem); $toChange = 'it'; $lastIt = strripos($paragraph, $toChange); $changeTo = substr($paragraph, $lastIt, strlen($toChange)); $changed = str_ireplace($toChange, $changeTo, $paragraph); pnl('Change all \'it\' to match the last \'it\':'); pnl($changed); $cap = str_replace(['a','e','i','o','u'], ['A','E','I','O','U'], $paragraph); pnl('Capitalise vowels:'); pnl($cap);
Output for git.master, git.master_jit, rfc.property-hooks
Sub String: simply dummy Starting postion of first simply: 15 Starting postion of last Lorem: 567 Starting postion of first SImpLY (case insensative): 15 String String: simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Replacing Strings: Heyyy is simply dummy text of the printing and typesetting industry. Heyyy has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Heyyy passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Heyyy. Replacing Strings Case Insensitive: Oh is simply dummy text of the printing and typesetting industry. Oh has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Oh passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Oh. Length of the whole paragraph: 579 My Own strstr: specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Last Lorem Onwards: Lorem Ipsum. or: Lorem Ipsum. Just the last lorem (diff way?): Lorem Change all 'it' to match the last 'it': Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. it has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. it was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Capitalise vowels: LOrEm IpsUm Is sImply dUmmy tExt Of thE prIntIng And typEsEttIng IndUstry. LOrEm IpsUm hAs bEEn thE IndUstry's stAndArd dUmmy tExt EvEr sIncE thE 1500s, whEn An UnknOwn prIntEr tOOk A gAllEy Of typE And scrAmblEd It tO mAkE A typE spEcImEn bOOk. It hAs sUrvIvEd nOt Only fIvE cEntUrIEs, bUt AlsO thE lEAp IntO ElEctrOnIc typEsEttIng, rEmAInIng EssEntIAlly UnchAngEd. It wAs pOpUlArIsEd In thE 1960s wIth thE rElEAsE Of LEtrAsEt shEEts cOntAInIng LOrEm IpsUm pAssAgEs, And mOrE rEcEntly wIth dEsktOp pUblIshIng sOftwArE lIkE AldUs PAgEMAkEr InclUdIng vErsIOns Of LOrEm IpsUm.

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:
15.59 ms | 417 KiB | 5 Q