3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $your_variable = '[section title="This is the title"]'; $your_variable = str_replace('type="full" type="wrapper"]','type="full"]',preg_replace ( '/\[section([^\]]+)(?!type)\]/i' , '[section$1 type="wrapper"]' , $your_variable )); echo "First try (got to add the wrapper...): ".$your_variable."\n"; $your_variable = '[section title="This is the title" type="full"]'; $your_variable = str_replace('type="full" type="wrapper"]','type="full"]',preg_replace ( '/\[section([^\]]+)(?!type)\]/i' , '[section$1 type="wrapper"]' , $your_variable )); echo "Second try (leave it as is please...): ".$your_variable."\n";
Output for 4.3.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.2.0
First try (got to add the wrapper...): [section title="This is the title" type="wrapper"] Second try (leave it as is please...): [section title="This is the title" type="full"]