3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="wrap"> <div class="wp-checkbox" data-value="zf">content</div> <div class="wp-checkbox" data-value="tdp">content</div> </div>'; $pattern = '/=\"zf\">.*?<\/div>/'; $pattern2 = '/=\"tdp\">.*?<\/div>/'; $html = preg_replace( $pattern, '="zf">new content of div</div>', $html ); $html = preg_replace( $pattern2, '="tdp">new content of another div</div>', $html ); echo $html;

preferences:
16.61 ms | 402 KiB | 5 Q