This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 3D pie chart with GD library | |
* | |
**/ | |
// Create an image | |
$image = imagecreatetruecolor(100, 100); | |
// Allocate some colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* User defined stream filter sample | |
* Source: http://php.net/manual/pt_BR/function.stream-filter-register.php | |
**/ | |
class string_filter extends php_user_filter | |
{ | |
function filter($in, $out, &$consumed, $closing) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* SPL Sample | |
* | |
*/ | |
$file = new SplFileObject(__FILE__); | |
foreach ($file as $line) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Using file socket to read a page | |
* Sample from internet | |
*/ | |
$fp = fsockopen ("slashdot.org", 80); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP, PDO and SQLite2 example | |
* The code got from Internet | |
* | |
*/ | |
// Set default timezone | |
date_default_timezone_set('UTC'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function innerHTML($el) { | |
$doc = new DOMDocument(); | |
$doc->appendChild($doc->importNode($el, TRUE)); | |
$html = trim($doc->saveHTML()); | |
$tag = $el->nodeName; | |
return preg_replace('@^<' . $tag . '[^>]*>|</' . $tag . '>$@', '', $html); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* XSLT transformations */ | |
$owner = "PhpFiddle"; | |
$collection_xsl = <<<DOC | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:param name="owner" select="'Nicolas Eliaszewicz'"/> | |
<xsl:output method="html" encoding="iso-8859-1" indent="no"/> | |
<xsl:template match="collection"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_POST['kelas'] = isset($_POST['kelas']) ? $_POST['kelas'] : 0; // this line removes notices (ignore this) | |
$_POST['tahun'] = isset($_POST['tahun']) ? $_POST['tahun'] : 0; // this line removes notices (ignore this) | |
?> | |
<form method='post'> | |
<select name='kelas'> | |
<option value=0>Pilih kelas</option> | |
<option value=1 <?php if($_POST['kelas']==1) echo 'selected' ?> >X-1</option> | |
<option value=2 <?php if($_POST['kelas']==2) echo 'selected' ?> >X-2</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$html = '<table border=1> | |
<tr> | |
<td>1</td> | |
<td>2</td> | |
<td>3</td> | |
<td>4</td> | |
<td>5</td> | |
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* My Color */ | |
$today = date("w"); | |
$bgcolor = array | |
( | |
"#FEF0C5", "#FFFFFF", "#FBFFC4", "#FFE0DD", | |
"#E6EDFF", "#E9FFE6", "#F0F4F1" | |
); |
OlderNewer