- str_replace: documentation ( source)
- preg_replace: documentation ( source)
<?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";