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 | |
Interface WeatherInterface { | |
public function getWeather(); | |
} | |
class WeatherBot implements WeatherInterface { | |
public function getWeather() { | |
// imagine something more complicated | |
return 'Sunny'; |
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
sudo http_proxy="http://wwwcache.lmu.ac.uk:3128" aptitude install curl | |
# add to .bashrc: | |
export http_proxy="http://wwwcache.lmu.ac.uk:3128" |
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
<form method="post"> | |
Name: <input type="text" name="name" /> | |
<br /> | |
<input type="submit" /> | |
</form> | |
<? | |
if($_POST) { | |
echo "Hello, " . filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING); |
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
Some lovely code, how nice! |
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 | |
// phpinfo(); | |
echo "verb: " . $_SERVER['REQUEST_METHOD'] . "\n"; | |
echo "headers:"; | |
var_dump(apache_request_headers()); | |
echo "\n"; |
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
Some riveting text |
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
If I had the time, I'd make a rhyme |
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 | |
ini_set('user_agent', "PHP"); // github requires this | |
$api = 'https://api.github.com'; | |
$url = $api . '/users/lornajane/gists'; | |
// make the request | |
$response = file_get_contents($url); | |
// check we got something back before decoding |
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
Average time to run bench.php on my laptop, by PHP version | |
• 5.2.17: 3.77 seconds | |
• 5.3.23: 2.63 seconds | |
• 5.4.15: 1.98 seconds | |
• 5.5RC1: 2.11 seconds |
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
function makeImgTag($src) { | |
return "<img src=\"" . $src . "\" />"; | |
} |