3v4l.org

run code in 300+ PHP versions simultaneously
/* inside index.php */ <div class="row"> <?php include_once 'show_posts.php'; ?> </div> /* show_posts.php */ <?php //session_start(); require_once 'dbconfig.php'; try { $stmt = $db_con->prepare("SELECT * FROM `PJW_posts`"); if ($stmt->execute()) { while ($results = $stmt->fetch(PDO::FETCH_ASSOC)) { include 'posts.phtml'; } } } catch (PDOException $e) { echo $e->getMessage(); } /* posts.phtml */ <div class="col-md-4"> <div class="card mb-4 box-shadow"> <img class="card-img-top" src="<?= htmlentities($results["img"], ENT_QUOTES) ?>"> <div class="card-body"> <h3><?= htmlentities($results["title"], ENT_QUOTES) ?></h3> <p class="card-text"><?= htmlentities(substr($results["text"], 0, 200), ENT_QUOTES) ?>...</p> <div class="d-flex justify-content-between align-items-center"> <div class="btn-group"> <button type="button" class="btn btn-sm btn-outline-secondary" onclick="window.location.href = '<?= htmlentities($results["id"], ENT_QUOTES) ?>/<?= htmlentities($results["post_link"], ENT_QUOTES) ?>'">View</button> /* user button */ <?php session_start(); if ($_SESSION["user_admin"]) { $edit_link = htmlentities($results["id"]) . "/" . htmlentities($results["post_link"]); echo '<button type="button" class="btn btn-sm btn-outline-danger" onclick="window.location.href="' . $edit_link . '">Update</button>'; } ?> /* admin button */ </div> <small class="text-muted">Added: <?= htmlentities($results["datetime"], ENT_QUOTES) ?></small> </div> </div> </div> </div>

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)
7.2.40.1880.01117.79
7.2.30.1700.01817.93
7.2.20.1690.01117.59
7.2.10.1800.01017.77
7.2.00.1800.01217.84
7.1.160.1970.01216.73
7.1.150.1290.00816.73
7.1.140.1670.01016.63
7.1.130.1730.01216.52
7.1.120.2080.01216.73
7.1.110.1780.01216.05
7.1.100.1860.01315.83
7.1.90.2980.01015.93
7.1.80.1810.01216.12
7.1.70.1570.00915.13
7.1.60.2050.01133.22
7.1.50.2290.01332.62
7.1.40.3150.01532.57
7.1.30.2700.01232.39
7.1.20.2890.01232.52
7.1.10.1950.00914.64
7.1.00.2530.01214.51

preferences:
145.91 ms | 1394 KiB | 7 Q