Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_029528.php
Created May 21, 2018 10:04
[ Posted by Biswa Bandhu Bhandary ] This code generates the below pattern if we set modulus divider value 3 i = 0;j = 0; i = 1;j = 0; i = 2;j = 0; i = 3;j = 1; i = 4;j = 1; i = 5;j = 1; i = 6;j = 2; i = 7;j = 2; so on...
<?php
$i = 0;
$_SESSION['k'] = 0;
while ($i<1000){
do_mail($i);
$i++;
}
@phpfiddle
phpfiddle / fiddle_060562.php
Created May 7, 2018 19:59
[ Posted by Sebastian ] BedLeveling Function BED_LEVELING_METHOD == 1 of Repetier in php
<?php
/**
* The code from http://php.net/manual/en/imagick.examples-1.php
*
* Make sure only using PHP builtin fonts(http://php.net/manual/en/haru.builtin.fonts.php)
*
* @package PhpFiddle
* @link http://phpfiddle.org
* @since 2012
@phpfiddle
phpfiddle / fiddle_015079.php
Created May 4, 2018 14:56
[ Posted by David Thomson ] recursion truth test
<?php
class Compare
{
private static $instance = null;
private function __construct()
{
}
public function is($a, $b, $condition)
{
$meth = array(
@phpfiddle
phpfiddle / fiddle_055530.php
Created May 4, 2018 14:54
[ Posted by David Thomson ] Recursion for evaluating truth using operators AND OR
<?php
class Compare
{
private static $instance = null;
private function __construct()
{
}
public function is($a, $b, $condition)
{
$meth = array(
<pre>
<?php
$var = "семен петрович";
$arr = ['c кавычками'=>'\''.$var."'", 'без кавычек'=>$var, 'второй варииант'=>"'$var'", 'по другому'=>"\"$var\"", 'по другому2'=>'"'.$var.'"', 'жестоко'=>'&laquo;'.$var.'&raquo;'];
print_r($arr);
?></pre>
@phpfiddle
phpfiddle / fiddle_058813.php
Created April 13, 2018 16:45
[ Posted by Jayowl ] Pass argument into array in php
<?php
function getimg($sizeindex, $imgname ){
$imgsizes = array(
'x1267'=>'This is size 0 ' . $imgname ,
'x1268'=>'this is size 1 '. $imgname,
'x1269'=>'this is size two '. $imgname,
'x1210'=>'this is size three '. $imgname,
);
echo "My favorite number is " . $imgsizes[$sizeindex];
@phpfiddle
phpfiddle / fiddle_040668.php
Created April 12, 2018 18:58
[ Posted by Asgedom ] this code is to display the discount price
<?php
//this is a single comment
#this is also a single line comment
/*this is a multiple
line comment
*/
//PHP statement end with a semicolon
@phpfiddle
phpfiddle / fiddle_079137.php
Created April 11, 2018 13:37
[ Posted by Mariusz ] lkadsjaslkdjaslkdja
<?php
echo 'Hello world';
?>
@phpfiddle
phpfiddle / fiddle_096610.php
Created April 11, 2018 13:30
[ Posted by Mariusz ] sDASDASAFSSD
<?php
echo 'sample code';
?>
@phpfiddle
phpfiddle / fiddle_019884.php
Created April 11, 2018 13:29
[ Posted by Mariusz ] sample gist test
<?php
echo 'Hello World';
?>