3v4l.org

run code in 150+ 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: ".$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 "First try: ".$your_variable."\n";
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
First try: [section title="This is the title" type="wrapper"] First try: [section title="This is the title" type="full"]