Skip to content

Instantly share code, notes, and snippets.

Gordon Lesti GordonLesti

Block or report user

Report or block GordonLesti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@GordonLesti
GordonLesti / multiarrayaccess.php
Created Feb 20, 2015
Multidimensional ArrayAccess
View multiarrayaccess.php
<?php
class MultiArrayAccess implements ArrayAccess
{
public function offsetExists($offset)
{
echo " EXISTS ";
print_r($offset);
echo "\n";
}
@GordonLesti
GordonLesti / arrayFillBenchmark.php
Last active Aug 29, 2015
PHP Array Fill Benchmark
View arrayFillBenchmark.php
<?php
$max = 10000000;
$testValues = range(1, $max);
echo php_uname();
echo "\nFill Array with appending elements and for loop\n";
$time = microtime(true);
$newArray = [];
@GordonLesti
GordonLesti / levenshtein1.php
Created Feb 5, 2014
Levenshtein distance 1
View levenshtein1.php
<?php
function getLevenshtein1($word)
{
$words = array();
for ($i = 0; $i < strlen($word); $i++) {
// insertions
$words[] = substr($word, 0, $i) . '_' . substr($word, $i);
// deletions
$words[] = substr($word, 0, $i) . substr($word, $i + 1);
You can’t perform that action at this time.