Skip to content

Instantly share code, notes, and snippets.

<?php
// Fetch data from the database
function my_mod_fetch_from_db() {
// Remember the number of dimensions of the static cache depends
// on the number of parameters that this function can take.
$cache = &drupal_static(__FUNCTION__, array());
// Static cache miss
if (empty($cache)) {
// Check persistent cache
@amarnus
amarnus / circular_primes.php
Created February 18, 2012 17:37 — forked from anonymous/circular_primes.php
List of all the circular primes under a million
<?php
ini_set('memory_limit', '256M');
$maximum = 1000000; // a million if you were wondering..
global $values;
function check_if_circular($prime) {
global $values;
$back2back = $prime . $prime; // 7373
$count = strlen($prime);
for($i = 0; $i <= $count - 1; ++$i) {