$number = int(1);
By Richard Chipper, 2017-12-14 08:22:23
<?php

// This code supposed to find adjacent items of a specific one
// $list is an array of ids
// $itemToSearch is an id that might be in the $list

foreach ($list as $item) {
    next($list);
    if ($item == $itemToSearch) {
        break;
    }
    $previousItem = $item;
}
$nextItem = current($list);

The $list variable is a list of ids, e.g [1, 2, 3, 4, 5] The $itemToSearch is an id that might be in $list

By baueri, 2022-05-31 17:30:21
switch ($content) {
    case "vid":
      echo '<iframe width="600" height="450" src="http://www.youtube.com/embed/' . $img . '" frameborder="0" allowfullscreen></iframe>';
      break;
    default:
      if ($height > 0 && $width > 0) {
        echo '<img width="' . $width . '" height="' . $height . '" src="http://szpileczki.com/up/' . $img . '"/>';
      } else {
        if ($kochamto == 1) {
          echo '<img src="http://kocham.to/up/' . $img . '"/>';
        } else {
          echo '<img src="http://szpileczki.com/up/' . $img . '"/>';
        }
      }
      break;
 }

especially if one of them doesn't exist since 2012

By Anonymous, 2016-11-19 14:54:36

//https://gist.github.com/nim4n136/7fa38467181130f5a2270c39d495101e

function decrypt($msg_encrypted_bundle, $password){
	$password = sha1($password);

	$components = explode( ':', $msg_encrypted_bundle );
	$iv            = $components[0];
	$salt          = hash('sha256', $password.$components[1]);
	$encrypted_msg = $components[2];

	$decrypted_msg = openssl_decrypt(
	  $encrypted_msg, 'aes-256-cbc', $salt, null, $iv
	);

	if ( $decrypted_msg === false )
		return false;
	return $decrypted_msg;
}
By Anonymous, 2022-05-30 18:28:02
<?php 
$k =1;
for($v = 0; $v < $nt; $v++) {         
	$bgClass= 'blueBg';
		if($k > 1 && $k%2 == 0){
			$bgClass= 'whiteBg';
		}
?> 
<tr  class="row_tr <?php echo $bgClass;?>">						
			<td class="row_td td_column_0">&nbsp;</td>					
			<td class="row_td column_1"><?php echo $rows[$v]['nothing'];?></td>
			...
			<td class="row_td td_column_0">&nbsp;</td>
	</tr>

<?php       
	$k++;
	}	
?>
By Unknown, 2018-02-13 14:47:19
<style type="text/css">
    <?php echo file_get_contents(
            \realpath(ROOT_PATH . '/public/').$this->assetPath('css/styles.css', true)
            ); ?>
</style>

Including style file (about 100kb) directly to HTML page. Thanks for developer, it's in .

By Ed, 2023-07-28 10:51:07
          //////////////////////////////////////////
          // Add ROI coordinates into Environment
          //////////////////////////////////////////
          AddROIcoordinatesIntoEnvironment();

It really helped me understand the code.

By Anonymous, 2022-05-30 00:49:45
if ($this->getTestSku()) {
   ...
} elseif ($this->getTestOffset() >= 0 && $this->getTestLimit() > 0) {
   ...
} else {
   Mage::throwException(sprintf("Invalid parameters for test mode: sku %s or offset %s and limit %s", $this->getTestSku(), $this->getTestOffset(), $this->getTestLimit()));
}
By Anonymous, 2018-03-13 13:56:56
#33 PHP -5
<?
if (ini_get('register_globals') != 1){
if ((isset($_POST) == true) && (is_array($_POST) == true)) extract($_POST, EXTR_OVERWRITE);
if ((isset($_GET) == true) && (is_array($_GET) == true)) extract($_GET, EXTR_OVERWRITE);}
By Sobak, 2015-07-21 07:59:13
{!! Form::select('ticket_category', \App\Models\Term::whereHas('taxonomy', function($query) {
    $query->where('slug', 'ticket_category'); 
  })->whereIn('id', ['15', '16', '17', '18'])
  ->pluck('name','id'), old('ticket_category'), [
    'id' => 'ticket_category', 
    'class' => 'form-control', 
    'placeholder' => 'Seleccione una categoría']
  )
!!}

to do it in an array if you can put it in the database so that you still burn the position

By ingbenjamincordero@gmail.com, 2020-05-08 01:39:27
<?php
    if(isset($_POST['csrf'])){
        if($_POST['csrf'] !== $_SESSION['csrf']){
            return 'session expired!';
        }
    }

In all Sama Samaneh university and class management system from iran :)

By Mahmoud etc, 2017-12-14 11:21:23

abstract class ASong(
    var songId: Int = 0,
    var title: String? = "",
    var clipArt: String? = "",
    var artist: String? = "",
    var source: String? = "",
    var songType: Int = 0,
    var length: String? = "",
    var downloadPath: String? = "",
    var category: String? = ""
) : Parcelable {

    @Transient
    var totalDuration: Long = 0
    @Transient
    var currentPosition: Long = 0
    @Transient
    var playingPercent = 0

    private fun calculatePlayingPercent(): Int {
        return if (currentPosition == 0L || totalDuration == 0L) 0 else (currentPosition * 100 / totalDuration).toInt()
    }

}
© 2021 GitHub, Inc

Probably meant to stand for AbstractSong. Ens up sounding awkward or like somebody who just wrote their first class.

By peakvalleytech, 2021-11-13 00:07:44
<?php

class CasinoCode
{
    CONST POST = 'POST';
    CONST GET = 'GET';
    
    $data = $this->callAPI('/hidden', [], self::POST);

production code of an API with dozens of millions of requests per day.

By Anonymous, 2019-10-17 19:43:24
    public function getProfilePicture(Company $company, $id, $url = null) {
        // @TODO: Figure out how to do this.
        return null;
    }
By Anonymous, 2019-04-12 15:16:30
foreach($bookings as $booking) {
	$status = $apiController->getBookingStatus($booking);
	if($status->error == 1) {
		switch($status->message) {
			case "FIND_PRV_KO": continue; //Wrong parameters
			case "ERR_PREN_NOTFOUND": continue; //Request booking cannot be found
			case "ERR_PRV_NOTFOUND": continue; //Check-in not carried out
			default: continue;
		};
		continue;
	}
	//DO SOME STUFF...
}

Found this on a production website

By Samuel, 2021-03-29 17:52:33