Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_054904.php
Created July 31, 2017 17:37
[ Posted by Leandro ] ppppppppppppp
<?php
// Using environment library fiddle_envlib.php to files that saved under user id folder
//include "fiddle_envlib.php";
?>
@phpfiddle
phpfiddle / fiddle_038049.php
Created July 31, 2017 17:34
[ Posted by Leandro ] opoooooooooooooo
<?php
// Using environment library fiddle_envlib.php to files that saved under user id folder
//include "fiddle_envlib.php";
?>
@phpfiddle
phpfiddle / fiddle_029666.php
Created July 25, 2017 16:16
[ Posted by Mark Anderson ] Coding test
<?php
echo('hi');
?>
@phpfiddle
phpfiddle / fiddle_059878.php
Created July 20, 2017 19:56
[ Posted by Leandro ] 564j6j46hg54jg6h4j6gh4j6hg4j56hgj
<div style="width: 730px; margin: 20px auto; font-family:sans-serif;">
<?php
/** Include class */
require "GoogChart.class.php";
/** Create chart */
$chart = new GoogChart();
/*
@phpfiddle
phpfiddle / fiddle_022004.php
Created July 20, 2017 19:51
[ Posted by Leandro ] hjjghjfjhjfgggggggggghjhghgf
<?php
?>
@phpfiddle
phpfiddle / fiddle_026914.php
Created July 20, 2017 16:07
[ Posted by Aleksandar Puharic ] Example usage of interfaces in API clients classes. Doesn&#039;t communicate with actual API server but just tries to simulate the process. In reality, interface and implementing class should be in separate files with respective filenames and paths.
<?php
namespace InterfacesExampleApi;
/**
* Interface ApiClientInterface
* @package InterfacesExampleApi
*/
interface ApiClientInterface
{
@phpfiddle
phpfiddle / fiddle_084501.php
Created June 29, 2017 08:26
[ Posted by Beroza Paul ] Pyramid work
<?php
for($i=0; $i<10; $i++){
for($j=0; $j<$i; $j++){
echo $j+1 . " ";
}
echo "<br>";
}
?>
@phpfiddle
phpfiddle / fiddle_026929.php
Created June 28, 2017 18:45
[ Posted by Ellen Bajcar ] funky fibonacci numbers
<!DOCTYPE html>
<html>
<head>
<title>fibonacci Sequence</title>
<link rel="stylesheet" type="text/css" href="common.css" />
<style type="text/css">
th {
text-align: left;
background-color: #aaa;
}
@phpfiddle
phpfiddle / fiddle_021551.php
Created June 21, 2017 14:18
[ Posted by Hebert ] Let&#039;s try to convert Mysql to PDO
<?php
define( 'MYSQL_HOST', '//////' );
define( 'MYSQL_USER', '//////' );
define( 'MYSQL_PASSWORD', '//////' );
define( 'MYSQL_DB_NAME', '//////' );
try
{
$PDO = new PDO( 'mysql:host=' . MYSQL_HOST . ';dbname=' . MYSQL_DB_NAME, MYSQL_USER, MYSQL_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
@phpfiddle
phpfiddle / fiddle_041254.php
Created June 13, 2017 10:21
[ Posted by darkofgodd ] try to fetch html from url
<?php
libxml_use_internal_errors(true);
$html = file_get_contents('https://www.set.or.th/set/companyhighlight.do?symbol=CPALL&ssoPageId=5&language=th&country=TH');
$doc = new DOMDocument();
$doc->loadHTML($html);
$maincontent = $doc->getElementById('maincontent');
$maincontent_html = $maincontent->ownerDocument->saveHTML($maincontent);
echo $maincontent_html;
?>