3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = "hello Mary."; $suffix = "added text to crop on condition"; $output .=$suffix; //append suffix to output $condition = true; // change to false to simulate case where no cropping is needed if($condition){ $suffix_len = strlen($suffix); //length of the suffix $output_len = strlen($output); //length of the whole output (including suffix) //if suffix is found at the end of the output if(substr($output,$output_len-$suffix_len) == $suffix){ $output = substr($output,0,$output_len-$suffix_len); //crop } } echo $output;
Output for git.master, git.master_jit, rfc.property-hooks
hello Mary.

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:
164.52 ms | 405 KiB | 5 Q