<?php
$now = time();

while ($now + 10 > time()) {
    
    // Just chill...smoke a blunt
}

echo "Done.\n";
By Sobak, 2015-07-21 12:30:55
if ($getCount) {
    foreach ($all_items as $item) {
        $item_arr[$item->id] = 0;
    }
    
    return count($item_arr);
}
By Anonymous, 2020-01-08 22:15:04
if((substr($onefile, -4) == ".Mp3") OR 
    (substr($onefile, -4) == ".ogg") OR 
    (substr($onefile, -4) == ".OGG") OR 
    (substr($onefile, -4) == ".oGG") OR 
    (substr($onefile, -4) == ".OGg") OR 
    (substr($onefile, -4) == ".Ogg") OR 
    (substr($onefile, -4) == ".OgG") OR 
    (substr($onefile, -4) == ".mP3") OR 
    (substr($onefile, -4) == ".MP3") OR 
    (substr($onefile, -4) == ".mp3")){
    
    // do stuff
} 

gotta make sure you account for capitalization

By Kyuunex, 2018-07-02 04:58:09
<?php

if ($_GET['csrfstopper'] !== 1){
    exit();
}

Please don't judge my friend trying to stop CSRF Attacks he's still learning.

By Lunorian, 2017-12-14 04:37:45
#274 PHP +55
foreach ($k as $kk) {
    foreach ($kk as $kkk) {
    }
}
By Anonymous, 2018-04-05 14:50:22
try {
	$order->addItem($item);
} catch (Exception $ex) {
	throw $ex;
}
By baueri, 2019-04-10 16:49:46
<?
function null($null) {
    return null;   
}
By SH2, 2018-02-20 11:31:33
<input type="button" value="Go and fill  later" onclick="javascript:window.location='<?php echo $url; ?>info.php'" />

Well, a is obsolete, let's do links as buttons!

By Anonymous, 2017-02-14 20:36:30
        $gallery = \common\models\UtVideogallery::find()->select(['ut_videogallery.VideogalleryID',
                'ut_videogallery.Name_rus','ut_videogallery.TournamentID','ut_videogallery.MatchID', 'Slug',
                'ut_videogallery.Date','COUNT(ut_video_to_gallery.VideoToGalleryID) count','ut_matches_videos.Data',
                'm1.Data DataP'])
                ->leftJoin('ut_video_to_gallery','ut_video_to_gallery.VideogalleryID=ut_videogallery.VideogalleryID')
                ->leftJoin('ut_matches_videos','ut_matches_videos.VideoID=ut_video_to_gallery.VideoID')
                ->leftJoin('ut_matches_videos m1','m1.VideoID=ut_videogallery.PreviewID')
                ->where(['ut_videogallery.Active'=>1])
                //->andWhere(['TournamentID'=>$list['selected']])
                ->groupBy('ut_videogallery.VideogalleryID')
                ->orderBy('ut_videogallery.Date DESC')
                ->limit(self::$countPerPage)
                ->asArray()->all();
        foreach ($gallery as $key => $value) {
            if($value['count']==0) unset($gallery[$key]);
        }
        foreach($gallery as $k=>$v){
            if(isset($v['Data']))
                $v['Data'] = str_replace('http:','https:',$v['Data']);
            if(isset($v['DataP']))
                $v['DataP'] = str_replace('http:','https:',$v['DataP']);
            $gallery[$k]=$v;
        }
        $galleryCount = \common\models\UtVideogallery::find()->select(['ut_videogallery.VideogalleryID',
                'ut_videogallery.Name_rus','ut_videogallery.TournamentID','ut_videogallery.MatchID',
                'ut_videogallery.Date','COUNT(ut_video_to_gallery.VideoToGalleryID) count','ut_matches_videos.Data'])
                ->leftJoin('ut_video_to_gallery','ut_video_to_gallery.VideogalleryID=ut_videogallery.VideogalleryID')
                ->leftJoin('ut_matches_videos','ut_matches_videos.VideoID=ut_video_to_gallery.VideoID')
                ->leftJoin('ut_matches_videos m1','m1.VideoID=ut_videogallery.PreviewID')
                ->where(['ut_videogallery.Active'=>1])
                //->andWhere(['TournamentID'=>$list['selected']])
                ->groupBy('ut_videogallery.VideogalleryID')   
                ->orderBy('ut_videogallery.Date DESC')
                ->asArray()->all();
        foreach ($galleryCount as $key => $value) {
            if($value['count']==0) unset($galleryCount[$key]);
        }
        $pagination = new \yii\data\Pagination(
        [
            'totalCount' => count($galleryCount),
            'pageSize' => self::$countPerPage,

        ]);

Picasso of PHP

By chernomorets, 2017-03-03 11:26:18
//Говорящие названия - такие говорящие!
    function asdfasdf (WebAPI_Entity $screenshot_dictionary)
    {
        $result = array();
        foreach ($screenshot_dictionary->getEntities () as $scr)
        {
            $result [] = $scr->toObject ();
        }
        usort($result, array ($this, 'sortScreenshots'));
        return $this->prepare_screenshots ($result);
    }
    
// вставляем остальные скриншоты
$elements = $this->asdfasdf ($screenshot_dictionary);
By C.H., 2019-10-07 16:47:29
$_POST = $this->db->mres($_POST);
$_SESSION['post'] = $_POST;

$sql = "SELECT id, documento, nombre1, nombre2, apellido1, apellido2 "
        . "FROM usuarios "
        . "WHERE " .
    "REPLACE(" .
        "REPLACE(" .
            "REPLACE(" .
                "REPLACE(telefono,' ','')," .
                "'(','')," .
            "')','')," .
        "'-','') LIKE '%{$searchTel}'";
By Carlos Correa, 2016-09-16 22:11:38
date('Y-m-d').'T'.date("H:i:s", strtotime("- 1 hour")).'Z'

Back to the future

By loutre, 2018-12-19 15:37:45
$net_price = "var net_price = " . json_encode($net_price) . ";";

This is a Javascript variable being created inside of a PHP string.

By notmycode, 2017-12-12 16:47:24
in_array($this->market, ["ru"])

There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive

By Anonymous, 2018-03-12 14:47:24
<?php
public function parse($package)
{
if(isset($package["type"]) && $package["type"] == "unavailable")
{
    if(((time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 30 && (isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && self::$xmpp->users[(string)$package["from"]]["messages"] < 2) && (time() - self::$xmpp->startTime) > 50)) || (!isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 900 && (time() - self::$xmpp->startTime) > 900))
    {
	if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
	{
	    self::$xmpp->ban(strstr($package["from"], "/", true), self::$xmpp->users[(string)$package["from"]]["jid"]);
	    self::$xmpp->groupMessage(strstr($package["from"], "/", true), substr(strstr($package["from"], "/"), 1)." został zbanowany/a za przeciąg!");
	}   
    }
    else
	if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
	    file_put_contents("friends.txt", file_get_contents("friends.txt")."\n".strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true));
}    
}

In fact whole project is shitty as hell, if you want have some fun grab popcorn and read all the sources: XPBot on sourceforge

By Kadet, 2015-07-21 12:51:32