3v4l.org

run code in 300+ PHP versions simultaneously
<?php $b= 1234; $your_variable = '<div style="width:768px;height:94px;left:17px;top:17px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex5"></div><div style="width:401px;height:153px;left:17px;top:118px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex6"></div><div style="width:400px;height:201px;left:17px;top:279px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex7"></div><div style="width:360px;height:359px;left:425px;top:119px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex8"><form method="post" action="https://www.leadformix.com/bf/FormCapture.php" class="no-lfm" name="lfxform"><input name="LFMIdsite" value="8635" type="hidden"><input name="returnURL" value="http://channel.netgear.com/success.html" type="hidden"><input name="LFMC" id="LFMC" value="0" type="hidden"><input name="campaign_urlid" id="campaign_urlid" value="CRMCAMPAIGNID" type="hidden"><span title_edit="editcontent"> <div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">First Name:</span><input name="firstnamelf1" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">Last Name:</span><input name="lastnamelf2" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">Email:</span><input name="emaillf3" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" class="adjstr"> </span><input name="submit4" style="font-family:arial; font-size:14px;cursor:pointer;" value="Submit" type="submit"><span title_edit="formeditcontent" class="crsntc"></span></div></span></form></div>'; $result = preg_replace('/<input name="LFMIdsite" value="(.*?)"/', '<input name="LFMIdsite" value="'.$b.'"', $your_variable); echo $result; //$lidsite = $matches[1]; //echo $lidsite; //$your_variable = str_replace('/name="LFMIdsite" value="'.$lidsite.'"', '/name="LFMIdsite" value="'.$b.'"', $your_variable); //echo $your_variable; ?>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<div style="width:768px;height:94px;left:17px;top:17px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex5"></div><div style="width:401px;height:153px;left:17px;top:118px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex6"></div><div style="width:400px;height:201px;left:17px;top:279px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex7"></div><div style="width:360px;height:359px;left:425px;top:119px;position:absolute;background-color:transparent;background-image:none;background-repeat:repeat;border-left:;border-right:;border-top:;border-bottom:;" id="ex8"><form method="post" action="https://www.leadformix.com/bf/FormCapture.php" class="no-lfm" name="lfxform"><input name="LFMIdsite" value="1234" type="hidden"><input name="returnURL" value="http://channel.netgear.com/success.html" type="hidden"><input name="LFMC" id="LFMC" value="0" type="hidden"><input name="campaign_urlid" id="campaign_urlid" value="CRMCAMPAIGNID" type="hidden"><span title_edit="editcontent"> <div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">First Name:</span><input name="firstnamelf1" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">Last Name:</span><input name="lastnamelf2" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" style="font-family:arial; font-size:14px; color:#000000;display:block;">Email:</span><input name="emaillf3" style="font-family:arial; font-size:14px; color:#000000;width:100px; height:20px; background-color:#ffffff;vertical-align:middle;" type="text"></div><div class="draggable" style="padding-top:15px;"><span title_edit="formeditcontent" class="adjstr"> </span><input name="submit4" style="font-family:arial; font-size:14px;cursor:pointer;" value="Submit" type="submit"><span title_edit="formeditcontent" class="crsntc"></span></div></span></form></div>

preferences:
297.13 ms | 413 KiB | 357 Q