3v4l.org

run code in 300+ PHP versions simultaneously
<?php $model = '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.'; $phrases= [ "printing and typesetting industry Lorem Ipsum" , "industry`s standard dummy text ever since the 1500s," ,"type specimen book, It has survived" ,"but also the leap into electronic typesetting, remaining essentially unchanged." ,"containing Lorem Ipsum passages and" ,"PageMaker including versions of Lorem Ipsum." ]; $phrases = array_map(function($phrase) { return preg_replace('/\s+/', '\s+', '/(' . preg_quote($phrase, '/') . ')/iu'); }, array_reverse($phrases)); echo $model = preg_replace($phrases, '<span style="color:red">$0</span>', $model);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the <span style="color:red">industry`s standard dummy text ever since the 1500s,</span> 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, <span style="color:red">but also the leap into electronic typesetting, remaining essentially unchanged.</span> 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 <span style="color:red">PageMaker including versions of Lorem Ipsum.</span>

preferences:
148.9 ms | 409 KiB | 5 Q