str replace - Proper use of multiple str_replace -


my code (simplified)

<div class="row-one">...</div> <div class="row-two">...</div> 

i want add these 2 divs inside wrapper

<div class="row-wrapper">...     <div class="row-one">...</div>     <div class="row-two">...</div> </div> 

using str_replace

$search  = array('<div class="row-one">','</div>'); $replace = array('<div class="row-wrapper"><div class="row-one">', '</div>');   $purchase_form = str_replace( $search, $replace, $purchase_form ); 

but need add

$search  = array('<div class="row-two">','</div>'); $replace = array('<div class="row-two">', '</div></div>');  

most examples of str_replace replacing words, me should between beginning div , ending div tag.

any appreciated.


Comments

Popular posts from this blog

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - SSE Emitter : Manage timeouts and complete() -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -