3v4l.org

run code in 300+ PHP versions simultaneously
<?php use Joomla\CMS\Language\Text; use Joomla\CMS\Date\Date; use Joomla\CMS\Factory; $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*') ->from('#__content') ->order('id DESC') ->limit('3'); $db->setQuery($query); ?> $cardTemplate = <<<HTML <div class="col-lg-4 col-md-6"> <div class="card"> %1$s <div class="card-body"> <a href="%2$s"> <h5 class="card-title mb-4">%3$s</h5> </a> <time datetime="%4$s" class="mb-2 text-muted">%4$s</time> <p class="card-text">%5$s</p> </div> </div> </div> HTML; $cards = []; foreach ($db->loadObjectList() as $row) { $introImage = json_decode($r->images)->image_intro ?? null; $cardTop = !$introimage || $introimage == '/' ? '<div class="card-img-top holding-image" alt="' . $row->title . '"></div>' : '<img class="card-img-top" src="' . $introImage . '" alt="' . $row->title . '"/>', $cards[] = sprintf( $cardTemplate, $cardTop, // %1$s JRoute::_('index.php?option=com_content&view=article&id=' . $row->id), // %2$s $row->title, // %3$s $row->publish_up, // %4$s mb_strimwidth($row->introtext, 0, 80, "..."), // %5$s } } $pageTemplate = <<<HTML <h2>Heading Here</h2> <div class="row"> %s </div> HTML; printf( $pageTemplate, implode("\n", $cards) );

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)
vld0.0060.00916.63
git.master0.0070.00716.81
git.master_jit0.0070.00716.81
rfc.partials0.0030.01216.87
rfc.literals0.0090.00616.96

preferences:
39.71 ms | 454 KiB | 5 Q