3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Loads thank'o'mat data for the Threadpage. * * @author Christian "Plunts" Grubert * @copyright 2010 Duetschi Kreativagentur * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package de.wbb3mods.wbb.thankbot */ class ThreadPageThankBotListener implements EventListener { /** * @see EventListener::execute() * @param ThreadPage $eventObj */ public function execute($eventObj, $className, $eventName) { if (empty($eventObj->postList->postIDs)) return; $thankdata = array(); $thankedFor = array(); $sql = "SELECT * FROM wbb".WBB_N."_thank_guests WHERE postID IN (".$eventObj->postList->postIDs.")"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (isset($thankdata[$row['postID']]['guests'])) $thankdata[$row['postID']]['guests']++; else $thankdata[$row['postID']]['guests'] = 1; } //$canUseOnlineMarking = version_compare(PACKAGE_VERSION, '3.1.0') >= 0; $sql = "SELECT thank_user.*, user.username" . ($canUseOnlineMarking ? ", g.userOnlineMarking usernameStyle" : "") . " FROM wbb" . WBB_N . "_thank_user thank_user LEFT JOIN wcf" . WCF_N . "_user user USING (userID) " . ($canUseOnlineMarking ? "LEFT JOIN wcf" . WCF_N . "_group g ON (user.userOnlineGroupID = g.groupID)" : "") . " WHERE thank_user.postID IN (" . $eventObj->postList->postIDs . ") ORDER BY " . THANKS_SORT; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if ($row['username'] == null) { if (isset($thankdata[$row['postID']]['guests'])) $thankdata[$row['postID']]['guests']++; else $thankdata[$row['postID']]['guests'] = 1; } else { if ($canUseOnlineMarking && !empty($row['usernameStyle']) && $row['usernameStyle'] != '%s') { $styledUsername = sprintf($row['usernameStyle'], StringUtil::encodeHTML($row['username'])); } else { $styledUsername = StringUtil::encodeHTML($row['username']); } $thankdata[$row['postID']]['users'][$row['userID']] = array('userID' => $row['userID'], 'username' => $row['username'], 'styledUsername' => $styledUsername, 'time' => $row['time']); } } if ($eventObj->board->getPermission('canThank') && !WCF::getSession()->spiderID) { $sql = "SELECT post.postID, post.userID, GROUP_CONCAT(DISTINCT thank_user.userID) AS userIDs, GROUP_CONCAT(DISTINCT thank_guests.iphash) AS iphashes FROM wbb".WBB_N."_post post LEFT JOIN wbb".WBB_N."_thank_user thank_user ON (post.postID=thank_user.postID) LEFT JOIN wbb".WBB_N."_thank_guests thank_guests ON (post.postID=thank_guests.postID AND thank_guests.time > ".(TIME_NOW-86400).") WHERE post.postID IN (".$eventObj->postList->postIDs.") AND post.hasThank = 1 GROUP BY post.postID ORDER BY post.time"; $result = WCF::getDB()->sendQuery($sql); $additionalSmallButtons = WCF::getTPL()->get('additionalSmallButtons'); $showLargeThankLink = array(); while ($row = WCF::getDB()->fetchArray($result)) { $row['userIDs'] = explode(',', $row['userIDs']); if ($row['userIDs'][0] == '') $row['userIDs'] = array(); $row['iphashes'] = explode(',', $row['iphashes']); if ($row['iphashes'][0] == '') $row['iphashes'] = array(); if ($row['userID'] != WCF::getUser()->userID) { // @todo autor = gast und user = gast sollte auch gehen $hasThanked = (in_array(WCF::getUser()->userID, $row['userIDs']) || in_array(sha1(UserUtil::getIpAddress()), $row['iphashes'])); WCF::getTPL()->assign(array( 'postID' => $row['postID'], 'hasThanked' => $hasThanked )); if (THANKS_BIGBUTTON && $row['postID'] == $eventObj->thread->firstPostID) { WCF::getTPL()->append('additionalLargeButtons', WCF::getTPL()->fetch('threadThankButton')); } elseif (THANKS_LINKPOS == 1) { $thankedFor[$row['postID']] = $hasThanked; } else { if (!isset($additionalSmallButtons[$row['postID']])) $additionalSmallButtons[$row['postID']] = ''; $additionalSmallButtons[$row['postID']] .= WCF::getTPL()->fetch('postThankButton'); } } } WCF::getTPL()->assign('additionalSmallButtons', $additionalSmallButtons); } if (THANKS_SHOWCOUNT) { $additionalSidebarUserCredits = WCF::getTPL()->get('additionalSidebarUserCredits'); foreach ($eventObj->sidebarFactory->messageSidebars AS $sidebar) { if (!isset($additionalSidebarUserCredits[$sidebar->getMessageID()])) $additionalSidebarUserCredits[$sidebar->getMessageID()] = ''; WCF::getTPL()->assign(array( 'thanks_got' => $sidebar->getUser()->thanks_got, 'thanks_given' => $sidebar->getUser()->thanks_given, 'userID' => $sidebar->getUser()->userID, 'postID' => $sidebar->getMessageID() )); $additionalSidebarUserCredits[$sidebar->getMessageID()] .= WCF::getTPL()->fetch('postThankCredits'); } WCF::getTPL()->assign('additionalSidebarUserCredits', $additionalSidebarUserCredits); } $additionalMessageFooter = WCF::getTPL()->get('additionalMessageFooter'); foreach ($eventObj->postList->posts AS $key=>$post) { if ($post->hasThank) { WCF::getTPL()->assign(array( 'postID' => $post->postID, 'postThanks' => isset($thankdata[$post->postID]) ? $thankdata[$post->postID] : null, 'isAuthor' => $post->userID == WCF::getUser()->userID && $post->userID != 0, 'hasThanked' => isset($thankedFor[$post->postID]) ? $thankedFor[$post->postID] : false )); $template = WCF::getTPL()->fetch('postThankStats'); if (!isset($additionalMessageFooter[$post->postID])) { $additionalMessageFooter[$post->postID] = $template; } else { $additionalMessageFooter[$post->postID] .= $template; } } } WCF::getTPL()->assign('additionalMessageFooter', $additionalMessageFooter); WCF::getTPL()->append('specialStyles', "\n".'<script src="' . RELATIVE_WBB_DIR . 'js/ThankOmat.class.js" type="text/javascript"></script>'."\n"); } private function isAuthor(Post $post) { if (WCF::getUser()->userID == 0) { return (UserUtil::getIpAddress() == $post->ipAddress && $post->userID == 0 && $post->time > TIME_NOW-86400); } else { return (WCF::getUser()->userID == $post->userID); } } } ?>

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.3.70.0130.00716.75
8.3.60.0070.00718.15
8.3.50.0130.00522.93
8.3.40.0100.00619.10
8.3.30.0110.00319.31
8.3.20.0050.00320.32
8.3.10.0040.00423.28
8.3.00.0080.00019.38
8.2.180.0100.00718.29
8.2.170.0030.01222.96
8.2.160.0060.00920.47
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.98
8.2.110.0070.00320.65
8.2.100.0030.00918.22
8.2.90.0030.00519.37
8.2.80.0030.00517.97
8.2.70.0030.00717.75
8.2.60.0000.00917.91
8.2.50.0040.00818.07
8.2.40.0000.00818.41
8.2.30.0000.00718.12
8.2.20.0090.00017.76
8.2.10.0000.00818.24
8.2.00.0060.00317.88
8.1.280.0110.00725.92
8.1.270.0090.00023.73
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.79
8.1.230.0040.00819.30
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0000.00917.48
8.1.180.0050.00318.10
8.1.170.0100.00018.71
8.1.160.0000.00822.15
8.1.150.0000.00718.88
8.1.140.0000.00817.53
8.1.130.0070.00017.96
8.1.120.0080.00017.54
8.1.110.0040.00417.44
8.1.100.0040.00417.49
8.1.90.0000.00817.58
8.1.80.0000.00717.53
8.1.70.0000.00717.55
8.1.60.0060.00317.61
8.1.50.0000.00917.43
8.1.40.0040.00417.63
8.1.30.0040.00417.70
8.1.20.0000.00817.73
8.1.10.0060.00317.53
8.1.00.0040.00417.56
8.0.300.0000.00818.77
8.0.290.0000.00816.88
8.0.280.0030.00318.58
8.0.270.0000.00717.32
8.0.260.0000.00717.30
8.0.250.0070.00017.10
8.0.240.0050.00217.14
8.0.230.0070.00017.19
8.0.220.0000.00717.11
8.0.210.0000.00817.07
8.0.200.0000.00617.04
8.0.190.0000.00816.99
8.0.180.0090.00017.12
8.0.170.0030.00617.11
8.0.160.0040.00417.16
8.0.150.0040.00716.87
8.0.140.0030.00617.01
8.0.130.0090.00013.48
8.0.120.0050.00516.98
8.0.110.0000.00817.04
8.0.100.0000.00717.04
8.0.90.0070.00017.02
8.0.80.0160.00017.08
8.0.70.0040.00416.96
8.0.60.0000.00717.15
8.0.50.0070.00017.03
8.0.30.0110.00817.23
8.0.20.0130.01017.40
8.0.10.0040.00417.01
8.0.00.0090.01016.92
7.4.330.0060.00015.05
7.4.320.0030.00316.45
7.4.300.0040.00416.68
7.4.290.0030.00316.61
7.4.280.0050.00516.66
7.4.270.0070.00316.71
7.4.260.0080.00016.68
7.4.250.0030.00516.59
7.4.240.0060.00216.64
7.4.230.0030.00516.58
7.4.220.0110.01116.70
7.4.210.0130.00616.54
7.4.200.0000.00716.56
7.4.160.0120.00816.57
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0140.00316.69
7.4.120.0040.01216.62
7.4.110.0110.00616.79
7.4.100.0060.01216.61
7.4.90.0110.00716.69
7.4.80.0060.01619.39
7.4.70.0090.01216.65
7.4.60.0070.01016.48
7.4.50.0030.00516.42
7.4.40.0070.01016.62
7.4.30.0130.00316.53
7.4.00.0070.01115.08
7.3.330.0030.00313.40
7.3.320.0030.00313.35
7.3.310.0040.00416.27
7.3.300.0000.00816.24
7.3.290.0080.00616.37
7.3.280.0070.00916.34
7.3.270.0100.00817.40
7.3.260.0090.00916.57
7.3.250.0120.00716.50
7.3.240.0080.00816.42
7.3.230.0000.01716.61
7.3.210.0130.00616.39
7.3.200.0130.00319.39
7.3.190.0100.00716.62
7.3.180.0150.00616.38
7.3.170.0130.00316.57
7.3.160.0070.01316.34
7.3.120.0000.01614.88
7.3.110.0100.01015.13
7.3.100.0090.00614.66
7.3.90.0090.00014.89
7.3.80.0070.01015.21
7.3.70.0000.01114.97
7.3.60.0100.00614.96
7.3.50.0000.01614.56
7.3.40.0000.01214.76
7.3.30.0030.00714.71
7.3.20.0070.00716.54
7.3.10.0090.00616.65
7.3.00.0060.00616.52
7.2.330.0080.00916.58
7.2.320.0100.00716.75
7.2.310.0130.00616.57
7.2.300.0070.01016.41
7.2.290.0070.01016.43
7.2.250.0090.01015.17
7.2.240.0090.00914.90
7.2.230.0130.00614.87
7.2.220.0040.00814.92
7.2.210.0060.00614.69
7.2.200.0130.00314.89
7.2.190.0120.00315.08
7.2.180.0070.00315.04
7.2.170.0060.00915.02
7.2.00.0030.00619.46
7.1.330.0060.00915.52
7.1.320.0120.00015.67
7.1.310.0070.00715.75
7.1.300.0110.00315.64
7.1.290.0000.01015.56
7.1.280.0060.00915.66
7.1.270.0080.00815.47
7.1.260.0040.00815.73
7.1.100.0040.00718.13
7.1.70.0000.01617.01
7.1.60.0070.01719.46
7.1.50.0070.01416.89
7.1.00.0030.07722.54
7.0.200.0000.01016.36
7.0.140.0130.06322.01
7.0.100.0500.07320.16
7.0.90.0500.06320.17
7.0.80.0430.08020.13
7.0.70.0500.07320.05
7.0.60.0670.07320.06
7.0.50.0470.07720.50
7.0.40.0100.07320.00
7.0.30.0070.05020.15
7.0.20.0000.08020.13
7.0.10.0100.07720.10
7.0.00.0100.07720.13
5.6.280.0030.07321.17
5.6.250.0130.07020.63
5.6.240.0000.09020.61
5.6.230.0170.07320.68
5.6.220.0100.07720.77
5.6.210.0070.08320.57
5.6.200.0070.08321.10
5.6.190.0230.06021.12
5.6.180.0100.08321.12
5.6.170.0070.08321.13
5.6.160.0070.04021.21
5.6.150.0000.08021.15
5.6.140.0100.07721.02
5.6.130.0070.08021.20
5.6.120.0170.05021.12
5.6.110.0070.07021.24
5.6.100.0170.07321.01
5.6.90.0130.07721.18
5.6.80.0100.07720.59
5.6.70.0100.04720.39
5.6.60.0130.04320.40
5.6.50.0070.05020.63
5.6.40.0030.08720.44
5.6.30.0100.08320.60
5.6.20.0100.07720.54
5.6.10.0170.07020.48
5.6.00.0130.05320.46
5.5.380.0030.04320.52
5.5.370.0100.05020.42
5.5.360.0100.08320.48
5.5.350.0030.08320.53
5.5.340.0170.06320.94
5.5.330.0200.07020.94
5.5.320.0130.07720.95
5.5.310.0100.07720.90
5.5.300.0070.08320.99
5.5.290.0100.07720.95
5.5.280.0070.08320.81
5.5.270.0100.07720.90
5.5.260.0130.07320.90
5.5.250.0130.06320.75
5.5.240.0030.08320.34
5.5.230.0100.07720.23
5.5.220.0070.07720.21
5.5.210.0070.07320.25
5.5.200.0070.06320.31
5.5.190.0100.08020.36
5.5.180.0100.07720.23
5.5.160.0170.06720.30
5.5.150.0070.07320.23
5.5.140.0070.07020.25
5.5.130.0130.07720.07
5.5.120.0070.08320.32
5.5.110.0000.07020.34
5.5.100.0070.08020.19
5.5.90.0070.07020.02
5.5.80.0100.06320.14
5.5.70.0170.06720.23
5.5.60.0030.05020.01
5.5.50.0030.08020.23
5.5.40.0130.07020.16
5.5.30.0100.05020.21
5.5.20.0070.08020.13
5.5.10.0100.07720.12
5.5.00.0070.07320.16
5.4.450.0030.06719.37
5.4.440.0070.07719.23
5.4.430.0100.06719.19
5.4.420.0070.08019.18
5.4.410.0030.04019.24
5.4.400.0130.07018.86
5.4.390.0070.08319.04
5.4.380.0070.07319.14
5.4.370.0130.07019.13
5.4.360.0030.08319.04
5.4.350.0070.07719.23
5.4.340.0100.07019.05
5.4.320.0070.07319.05
5.4.310.0130.07019.17
5.4.300.0030.08018.91
5.4.290.0070.07319.19
5.4.280.0130.08018.96
5.4.270.0130.07319.21
5.4.260.0070.07718.86
5.4.250.0030.07719.09
5.4.240.0030.08318.89
5.4.230.0100.07319.24
5.4.220.0030.05319.12
5.4.210.0100.07018.89
5.4.200.0100.07318.95
5.4.190.0070.08019.21
5.4.180.0000.08319.22
5.4.170.0070.07319.09
5.4.160.0070.07319.04
5.4.150.0170.05319.20
5.4.140.0030.05716.46
5.4.130.0070.07016.41
5.4.120.0100.07016.34
5.4.110.0000.07016.39
5.4.100.0070.05016.52
5.4.90.0100.07716.45
5.4.80.0100.07016.43
5.4.70.0100.05316.39
5.4.60.0200.06316.52
5.4.50.0070.06016.38
5.4.40.0070.06016.53
5.4.30.0200.05316.48
5.4.20.0030.03716.38
5.4.10.0000.08016.38
5.4.00.0070.04015.86

preferences:
42.63 ms | 401 KiB | 5 Q