Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_058469.php
Created July 25, 2014 13:58
[ Posted by Suyash Jain ] Php parent child recursive tree list
<?php
$datas = array(
array('id' => 1, 'parent' => 0, 'name' => 'Page 1'),
array('id' => 2, 'parent' => 1, 'name' => 'Page 1.1'),
array('id' => 3, 'parent' => 2, 'name' => 'Page 1.1.1'),
array('id' => 4, 'parent' => 3, 'name' => 'Page 1.1.1.1'),
array('id' => 5, 'parent' => 3, 'name' => 'Page 1.1.1.2'),
array('id' => 6, 'parent' => 1, 'name' => 'Page 1.2'),
array('id' => 7, 'parent' => 6, 'name' => 'Page 1.2.1'),
array('id' => 8, 'parent' => 0, 'name' => 'Page 2'),
@phpfiddle
phpfiddle / fiddle_018135.php
Created July 26, 2014 09:34
[ Posted by Nikita Rushmanov ] SimpleXML foreach unset
<?php
$xml = "
<results>
<result>
<guid>a</guid>
<version>3</version>
</result>
<result>
<guid>b</guid>
<version>2</version>
@phpfiddle
phpfiddle / fiddle_015370.php
Created August 25, 2014 15:05
[ Posted by Andy Li ] This is a CSS-only experiment. It uses CSS counter, CSS keyframe animation and CSS pseudo class &quot;:checked&quot;. It works on latest Chrome and Safari.
<?php
$id = rand();
$cellSize = 580;
$maxClick = 3000;
$timeLimit = 30; //in seconds
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
@phpfiddle
phpfiddle / 589ffafa209f9229aaa5a4efbb695d5e.php
Last active August 29, 2015 14:06
[ Posted by Valent ] класс для анализа XML - структуры
<?php
class A {
private $a, $b;
public function __construct($ob) {
$this->a = $ob->a;
$this->b = $ob->b;
}
@phpfiddle
phpfiddle / fiddle_054876.php
Created September 17, 2014 11:37
[ Posted by Valent ] тестовая программа
<?php
echo 'asasd';
?>
@phpfiddle
phpfiddle / fiddle_035500.php
Created September 23, 2014 03:38
[ Posted by Vince ] Makes a little circle of divs.
<?php $size = 40; ?>
<style>
.ball{
height:<?php echo $size;?>px; width:<?php echo $size;?>px; background-color:rgba(0,200,0,.025);
position:absolute;
border-radius: 50%;
text-align:center;
line-height:<?php echo $size;?>px;
color:rgba(0,59,0,.1);
font-family:sans-serif;
@phpfiddle
phpfiddle / fiddle_055486.php
Created September 23, 2014 23:39
[ Posted by Christie Mealo ] php practice 2
<?php
echo date("l F jS, Y - g:ia", time()); // current date
echo("</br>");
echo date("m / d / Y", time()); // current date
echo("</br>");
$nextweek= time() + 7*24*60*60;
echo gmdate("Y-m-d\TH:i:s\Z", $nextweek); // next week
?>
@phpfiddle
phpfiddle / fiddle_058983.php
Created September 23, 2014 23:34
[ Posted by Christie Mealo ] php exercise 1
<?php
$r = 0;
$g= 205;
$b = 205;
printf("<font size='30px', font color='#%X%X%X'>Hello</font><br />",$r,$g,$b);
printf("<font size='30px', font color='#%X%X%X'>Hello</font><br />",$r,$g-3,$b-3);
printf("<font size='30px', font color='#%X%X%X'>Hello</font><br />",$r,$g-6,$b-6);
printf("<font size='30px', font color='#%X%X%X'>Hello</font><br />",$r,$g-9,$b-9);
printf("<font size='30px', font color='#%X%X%X'>Hello</font><br />",$r,$g-12,$b-12);
@phpfiddle
phpfiddle / fiddle_054514.php
Created October 10, 2014 17:36
[ Posted by Tejram ] pdo sqlite database
<?php
/**
* PDO SQLite initial code
*
* Using phpLiteAdmin to admin SQLite3 and SQLite2 database : inclibs/util/sqlite3.db, inclibs/util/sqlite2.db
*
* @package PhpFiddle
* @link http://phpfiddle.org
* @since 2012
@phpfiddle
phpfiddle / fiddle_026206.php
Created October 15, 2014 15:51
[ Posted by Todd Coleman ] issettestHAC
<?php
$object = new StdClass;
$object->thor = false;
//$object->lock = true;
if (!$object->thor && !isset($object->lock))
echo "Show Destroy";
else
echo "Hide Destroy";