3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Test</title> </head> <body> <section id="about"> <div class="container about-container"> <div class="row"> <div class="col-md-12"> {{{block:welcome-intro}}} </div> </div> </div> </section> <section id="services"> <div class="container"> <div class="row"> <div class="col-md-12"> <p>You are using system version: {{{variable:system_version}}}</p> <p>Your address: {{{variable:contact-email-address}}}</p> <form action="http://k.loc/content/view/welcome" class="default-form" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <input type="hidden" name="csrfkcmstoken" value="94ee71ada809b9a79d1b723c81020c78" /> <div class="row"> <div class="col-sm-12 form-error"></div> </div> <div class="row"><div class="col-sm-12"><fieldset id="personalinfo"><legend>Personal information</legend><div class="row"><div class="col-sm-12"> <div class="control-label"> <label for="testinput">Name<span class="form-validation-required"> * </span></label> </div> <div class="hint-text">Enter at least 2 characters and a maximum of 12 characters.</div><input id="testinput" name="testinput" placeholder="Enter your name here." class="input-group width-50" type="text" value="{{{variable:system_name}}} {{{variable:system_login}}}"><div class="row"><div class="col-sm-12"><div class="form-error"></div></div></div></div></div><div class="row"><div class="col-sm-12"> <div class="control-label"> <label for="testpassword">Password</label> </div> <div class="hint-text">Your password must be at least 12 characters long, contain 1 special character, 1 nunber, 1 lower case character and 1 upper case character.</div><input id="testpassword" name="testpassword" placeholder="Enter your password here." class="input-group width-50" type="password"><div class="row"><div class="col-sm-12"><div class="form-error"></div></div></div></div></div></fieldset></div></div><div class="row"><div class="col-sm-12"><fieldset id="bioinfo"><legend>Biographical information</legend><div class="row"><div class="col-sm-12"> <div class="control-label"> <label for="testtextarea">Biography</label> <span class="hint-text">A minimum of 40 characters and a maximum of 255 is allowed. This hint is displayed inline.</span> </div> <textarea id="testtextarea" name="testtextarea" placeholder="Please enter your biography here." class="input-group-wide width-100" rows="5" cols="80">{{{variable:system_name}}} {{{variable:system_login}}}</textarea><div class="row"><div class="col-sm-12"><div class="form-error"></div></div></div></div></div><div class="row"><div class="col-sm-12"> <div class="control-label"> <label for="testsummernote">Interests</label> <span class="hint-text">A minimum of 40 characters is required. This hint is displayed inline.</span> </div> <textarea id="testsummernote" name="testsummernote" class="wysiwyg-editor" placeholder="Please enter your interests here."><p>{{{variable:system_name}}}<br></p><p>{{{variable:system_login}}}</p><p>{{{variable:activate_url}}}<br></p></textarea></div></div></fieldset></div></div><div class="row"><div class="col-sm-12"><button name="testsubmit" id="testsubmit" type="submit" class="btn primary">Submit<i class="zmdi zmdi-arrow-forward"></i></button></div></div> </form> </div> </div> </div> </section> </body> </html> HTML; define('LOOKUP', [ 'block' => [ 'welcome-intro' => 'custom intro' ], 'variable' => [ 'contact-email-address' => 'mmu@mmu.com', 'system_version' => 'sys ver', 'system_name' => 'sys name', 'system_login' => 'sys login', 'activate_url' => 'some url' ], ]); $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html); $xpath = new DOMXpath($dom); foreach ($xpath->query("//*[not(self::textarea or self::select or self::input) and contains(., '{{{')]/text()") as $node) { $node->nodeValue = preg_replace_callback('~{{{([^:]+):([^}]+)}}}~', function($m) { return LOOKUP[$m[1]][$m[2]] ?? '**unknown variable**'; }, $node->nodeValue); } echo $dom->saveHTML();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.120.0140.00722.71
8.4.110.0060.00519.42
8.4.100.0110.01118.39
8.4.90.0060.00621.23
8.4.80.0100.01019.28
8.4.70.0120.00919.24
8.4.60.0120.00520.86
8.4.50.0120.00921.22
8.4.40.0110.01120.17
8.4.30.0090.01220.84
8.4.20.0150.00620.95
8.4.10.0090.01218.35
8.3.250.0060.00419.77
8.3.240.0060.00317.09
8.3.230.0110.01017.18
8.3.220.0030.00719.89
8.3.210.0100.01117.41
8.3.200.0060.00417.43
8.3.190.0120.00717.79
8.3.180.0100.01019.37
8.3.170.0130.00619.15
8.3.160.0070.00417.58
8.3.150.0070.01317.50
8.3.140.0040.00417.51
8.3.130.0030.00617.34
8.3.120.0070.00319.54
8.3.110.0060.00320.94
8.3.100.0040.00419.11
8.3.90.0040.01226.77
8.3.80.0090.00017.97
8.3.70.0130.01017.50
8.3.60.0100.01019.18
8.3.50.0100.01322.46
8.3.40.0130.00619.85
8.3.30.0080.00819.42
8.3.20.0150.00022.39
8.3.10.0040.00420.84
8.3.00.0030.00524.34
8.2.290.0130.00917.09
8.2.280.0120.01019.04
8.2.270.0060.00917.10
8.2.260.0090.00617.73
8.2.250.0090.00018.80
8.2.240.0140.00717.67
8.2.230.0100.00022.58
8.2.220.0090.00017.37
8.2.210.0040.00426.77
8.2.200.0030.00717.13
8.2.190.0130.01017.13
8.2.180.0250.00718.69
8.2.170.0100.01022.96
8.2.160.0060.00919.90
8.2.150.0090.00024.18
8.2.140.0040.00824.66
8.2.130.0080.00026.16
8.2.120.0080.00026.16
8.2.110.0030.00620.14
8.2.100.0060.00618.31
8.2.90.0090.00018.25
8.2.80.0030.00619.39
8.2.70.0100.00018.13
8.2.60.0000.00818.41
8.2.50.0100.00018.38
8.2.40.0030.00718.53
8.2.30.0050.00318.83
8.2.20.0030.00618.52
8.2.10.0050.00319.94
8.2.00.0060.00319.93
8.1.330.0120.00917.13
8.1.320.0060.00416.73
8.1.310.0060.00317.31
8.1.300.0070.00718.47
8.1.290.0070.00718.88
8.1.280.0150.00725.92
8.1.270.0080.00022.66
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0070.00322.71
8.1.230.0060.00618.32
8.1.220.0000.00818.18
8.1.210.0060.00318.77
8.1.200.0070.00718.10
8.1.190.0030.00617.85
8.1.180.0030.00619.81
8.1.170.0050.00519.31
8.1.160.0050.00519.38
8.1.150.0000.00919.34
8.1.140.0030.00521.41
8.1.130.0080.00020.70
8.1.120.0060.00317.98
8.1.110.0000.00918.11
8.1.100.0000.00818.13
8.1.90.0040.00418.03
8.1.80.0000.00918.02
8.1.70.0000.00718.13
8.1.60.0000.00818.11
8.1.50.0050.00318.17
8.1.40.0000.00918.10
8.1.30.0050.00518.24
8.1.20.0000.01118.27
8.1.10.0040.00418.07
8.1.00.0000.00818.09
8.0.300.0040.00818.77
8.0.290.0040.00417.50
8.0.280.0090.00018.89
8.0.270.0000.00817.52
8.0.260.0000.00720.56
8.0.250.0000.00717.57
8.0.240.0050.00317.60
8.0.230.0030.00517.61
8.0.220.0000.00817.43
8.0.210.0040.00417.54
8.0.200.0000.00817.64
8.0.190.0050.00317.68
8.0.180.0030.00517.61
8.0.170.0030.00617.57
8.0.160.0000.00817.56
8.0.150.0050.00317.53
8.0.140.0030.00517.54
8.0.130.0030.00313.93
8.0.120.0040.00417.51
8.0.110.0000.00817.46
8.0.100.0000.00817.46
8.0.90.0060.00317.57
8.0.80.0110.00517.57
8.0.70.0030.00517.41
8.0.60.0000.00817.63
8.0.50.0040.00417.45
8.0.30.0110.01017.63
8.0.20.0120.00717.64
8.0.10.0000.00817.61
8.0.00.0110.01117.61
7.4.330.0050.00015.55
7.4.320.0040.00417.11
7.4.300.0030.00317.18
7.4.290.0000.00817.13
7.4.280.0000.00817.19
7.4.270.0040.00717.16
7.4.260.0060.00317.10
7.4.250.0060.00317.29
7.4.240.0020.00517.19
7.4.230.0000.00916.95
7.4.220.0050.00217.01
7.4.210.0060.01017.20
7.4.200.0040.00417.07
7.4.130.0100.01017.21
7.4.120.0120.01217.09
7.4.110.0110.00817.07
7.4.100.0140.00617.30
7.4.90.0060.01217.09
7.4.80.0120.00619.39
7.4.70.0090.01517.30
7.4.60.0110.00817.20
7.4.50.0040.00817.27
7.4.40.0110.01417.24
7.4.00.0070.01015.46
7.3.330.0000.00713.92
7.3.320.0030.00313.91
7.3.310.0030.00316.99
7.3.300.0040.00416.93
7.3.290.0060.01016.95
7.3.280.0170.00817.00
7.3.260.0100.01017.05
7.3.230.0130.01117.07
7.3.210.0170.01016.98
7.3.200.0070.01716.92
7.3.190.0060.01017.28
7.3.180.0140.00317.16
7.3.170.0150.00916.92
7.3.160.0090.00816.91
7.3.120.0000.01815.16
7.3.110.0140.00315.34
7.3.100.0110.00315.21
7.3.90.0070.00715.53
7.3.80.0090.00315.16
7.3.70.0080.01215.04
7.3.60.0150.00415.29
7.3.50.0110.00915.06
7.3.40.0100.01015.05
7.3.30.0120.01115.13
7.3.20.0210.00816.08
7.3.10.0130.01016.05
7.3.00.0060.00916.07
7.2.330.0100.01017.28
7.2.320.0030.02217.13
7.2.310.0040.01417.40
7.2.300.0030.01417.13
7.2.290.0030.02017.17
7.2.250.0040.01415.29
7.2.240.0030.01715.18
7.2.230.0100.00315.45
7.2.220.0120.00615.45
7.2.210.0080.00815.55
7.2.200.0090.01115.44
7.2.190.0100.01315.42
7.2.180.0100.01015.54
7.2.170.0030.01715.47
7.2.160.0170.01015.41
7.2.150.0130.01315.27
7.2.140.0170.01315.35
7.2.130.0150.01815.66
7.2.120.0190.00615.33
7.2.110.0180.00915.13
7.2.100.0260.00015.22
7.2.90.0130.01615.50
7.2.80.0000.01615.64
7.2.70.0100.01015.27
7.2.60.0150.01115.48
7.2.50.0090.01215.28
7.2.40.0140.00715.38
7.2.30.0140.00515.44
7.2.20.0180.00015.23
7.2.10.0160.00515.29
7.2.00.0070.00715.33
7.1.330.0070.00716.10
7.1.320.0000.01116.01
7.1.310.0070.00416.12
7.1.300.0060.01715.02
7.1.290.0120.00914.98
7.1.280.0110.01115.24
7.1.270.0110.01015.33
7.1.260.0140.00915.19
7.1.250.0180.00914.18

preferences:
27.78 ms | 403 KiB | 5 Q