3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<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>