Skip to content

Instantly share code, notes, and snippets.

@caefer
caefer / benchmark.php
Created November 25, 2010 09:10
benchmarks RecursiveDirectoryIterator against glob()
<?php
$testDir = dirname(__FILE__).'/test/';
$startTime = microtime(true);
$touches = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testDir)) as $filepath)
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bjoerns URL Shortener</title>
<meta name="author" content="Bjoern Wagner">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<?php
require __DIR__.'/vendor/facebook/src/facebook.php';
$app_id = '1234567890';
$secret = '0123456789abcdef0123456789abcdef0123456789abcdef';
$fb = new Facebook(array(
'appId' => $app_id,
'secret' => $secret,
<?php
$fb = new Facebook(array('appId' => ..., 'secret' => ..., 'cookie' => true));
$queries = array(
array('method' => 'GET', 'relative_url' => '/8882845892'),
array('method' => 'GET', 'relative_url' => '/67226614422'),
array('method' => 'GET', 'relative_url' => '/140959058191'),
);
<?php
// ...
$qb->add('where', 'x.date = :date')
->setParameter('date', new \DateTime('+2 days'));
// ...
test me
<script type="text/javascript" src="http://some.server.com/injection/experiment.js"></script>
$output .= $url . PHP_EOL;
$app->get('/', function () use ($urls) {
$output = '';
foreach ($urls as $url) {
$output .= $url;
}
return $output;
});
$urls = array('http://www.facebook.com', 'http://www.twitter.com', 'http://plus.google.com');