if ($getCount) {
    foreach ($all_items as $item) {
        $item_arr[$item->id] = 0;
    }
    
    return count($item_arr);
}
By Anonymous, 2020-01-08 22:15:04
<?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

$d = explode(".",$request->get("due_date",".."));
foreach ($d as $key => $val) $d[$key]=(int)$val;

if (
	!is_numeric($d[0]) || $d[0]<1 ||$d[0]>31 ||
	!is_numeric($d[1]) || $d[1]<1 ||$d[1]>12 ||
	!is_numeric($d[2]) || $d[2]<2005 ||$d[2]>2100 ) {
    $error["due_date"] = "Missing date.";
}

I think this was the last piece of code the developer wrote .... :D

By elpado, 2018-02-15 14:41:45
if (isset(self::$proposals[$view])) {
      $best_proposals = [];
      $all_sources = [];
      foreach (self::$proposals[$view] as $proposal_source => $proposal) {
        if (!isset($this->backend_branch) || substr($this->backend_branch, 0, 11) != "adjust-for:" || substr($this->backend_branch, 11) == $proposal_source) {
          if ($proposal['orig_base'] == $curr_base || $relax_checking) {
            $age = time() - $proposal['updated_at'];
            if ($age < self::MAX_AGE) {
              foreach ($proposal['proposals'] as $proposal_label => $proposal_price) {
                if (!in_array($proposal_label, [self::SK_LABEL_AVIASALES, self::SK_LABEL_SKYSCANNER, self::SK_LABEL_YANDEX, self::SK_LABEL_MOMONDO])) {
                  $proposal_key = $proposal_label;
                  if (!isset($best_proposals[$proposal_key]) || $best_proposals[$proposal_key]['price'] > $proposal_price) {
                    $best_proposals[$proposal_key] = [
                      'price' => $proposal_price,
                      'name' => $proposal_price . "@" . implode("~", array_map(function ($part) {
                          return preg_replace('/[~|=#@ ]/', '_', $part);
                        }, [
                          'label' => $proposal_label,
                          'source' => $proposal_source,
                        ])),
                      'age' => $age,
                    ];
                    $all_sources[$proposal_source] = null;
                  }
                }
              }
            }
          }
        }
      }
By Anonymous, 2018-01-24 12:49:44
    public function update($oldVersion) {
        switch ($oldVersion) {
            case '1.0.0':
            case '1.0.1':
                break;
            default:
                return false;
        }
        return true;
    }

Found in a Shopware Plugin

By Procinger, 2020-02-14 14:08:36
$i = 0;
 
if ($i == 'dupa') {
   echo 'dupa';
} else {
   echo 'nie dupa';
}

Do you think, that output is "nie dupa"? Just try...

By mademan, 2015-08-12 22:42:57
<?php

/**
 * SetSelectedPlanet.php
 *
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */

function SetSelectedPlanet ( &$CurrentUser ) {
	global $_GET;
By Sobak, 2015-07-21 06:57:52
if ( $ordinal_competitors > 0 ) {
	foreach( $ordinal_bests as $label => $tuple ) {
		unset( $waste[ $tuple['id']->{ '$id' } ] );
		$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['updated_at'] = $tuple['updated'];
		$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['proposals'][ $label ] = $tuple['price'];
		$final_count ++;
	}
}
  • So, you've called the variable "tuple"
  • Yes
  • What is tuple?
  • Eeeemmm...
  • You don't know. Me too, but my experience said that tuple is a collection, of N-arity where you can't ask by key and give exception, what data structure is placed here?
  • F..ing.. ph.. arr...
  • I can't hear you girl!
  • Fucking php array
  • So why did you call fucking php array a tuple?
  • I do not know...
  • Go f...ck yourself
By Anonymous, 2018-01-22 10:32:32
function hour_switvh($hour)
{
        $hour=$hour/2;
        if($hour==0.0){$hour="00:00";}
        if($hour==0.5){$hour="00:30";}
        if($hour==1.0){$hour="01:00";}
        if($hour==1.5){$hour="01:30";}
        if($hour==2.0){$hour="02:00";}
        if($hour==2.5){$hour="02:30";}
        if($hour==3.0){$hour="03:00";}
        if($hour==3.5){$hour="03:30";}
        if($hour==4.0){$hour="04:00";}
        if($hour==4.5){$hour="04:30";}
        if($hour==5.0){$hour="05:00";}
        if($hour==5.5){$hour="05:30";}
        if($hour==6.0){$hour="06:00";}
        if($hour==6.5){$hour="06:30";}
        if($hour==7.0){$hour="07:00";}
        if($hour==7.5){$hour="07:30";}
        if($hour==8.0){$hour="08:00";}
        if($hour==8.5){$hour="08:30";}
        if($hour==9.0){$hour="09:00";}
        if($hour==9.5){$hour="09:30";}
        if($hour==10.0){$hour="10:00";}
        if($hour==10.5){$hour="10:30";}
        if($hour==11.0){$hour="11:00";}
        if($hour==11.5){$hour="11:30";}
        if($hour==12.0){$hour="12:00";}
        if($hour==12.5){$hour="12:30";}
        if($hour==13.0){$hour="13:00";}
        if($hour==13.5){$hour="13:30";}
        if($hour==14.0){$hour="14:00";}
        if($hour==14.5){$hour="14:30";}
        if($hour==15.0){$hour="15:00";}
        if($hour==15.5){$hour="15:30";}
        if($hour==16.0){$hour="16:00";}
        if($hour==16.5){$hour="16:30";}
        if($hour==17.0){$hour="17:00";}
        if($hour==17.5){$hour="17:30";}
        if($hour==18.0){$hour="18:00";}
        if($hour==18.5){$hour="18:30";}
        if($hour==19.0){$hour="19:00";}
        if($hour==19.5){$hour="19:30";}
        if($hour==20.0){$hour="20:00";}
        if($hour==20.5){$hour="20:30";}
        if($hour==21.0){$hour="21:00";}
        if($hour==21.5){$hour="21:30";}
        if($hour==22.0){$hour="22:00";}
        if($hour==22.5){$hour="22:30";}
        if($hour==23.0){$hour="23:00";}
        if($hour==23.5){$hour="23:30";}
        if($hour==24.0){$hour="24:00";}

        return $hour;
}

added by dfj

By feri, 2017-12-13 11:15:02
<?php

function add_points ($resources, $userid) {
	return false;
}

function remove_points ($resources, $userid) {
	return false;
}

function get_userdata () {
	return '';
}
By Sobak, 2015-07-21 07:00:36
#64 :) PHP +184
        if ($act_number)
        {
        	$act_number = $act_number;
        }
        else
        {
        	throw new Exception("Документ еще не подготовлен.");
        }
By wata5h1, 2016-07-07 17:09:32
// sleep 150s
for ($a = 0; $a < 150 ; $a++ ) { 
      sleep(1);
}
By Anonymous, 2015-07-22 14:42:11
for ($i=0 ; $i<3 ; $i++) {
  switch($i) {
    case 1:
      // do some stuff
      break;
    case 2:
      // do some stuff
      break;;
    case 3:
      // do some stuff
      break;
  }
}
By Anonymous, 2015-07-22 14:40:25