Related Content
PHP Question: Variable Reference
Question
What does the following code print out?
function arrayPrint($array)
{
echo implode(' ', $array);
}
$arrayA = [1, 2, 3];
$arrayB = $arrayA;
$arrayB[1] = 0;
arrayPrint($arrayA);
Create Checksums Using The Luhn Algorithm In PHP
The Luhn algorithm was created by Hans Peter Luhn and is a way of creating a simple checksum for a number. This algorithm, also known as the mod 10 algorithm, is used in a wide variety of applications but is commonly associated with credit card numbers.
PHP: Find An Array Sequence In An Array
I was looking for a function that searched an array for another array, and after not finding one I decided to write it. What I was looking for was a function that took a smaller array and searched for that exact sequence of items in a larger array.
Conway's Game Of Life In PHP
I was saddened to hear of the passing of the Mathematician John Horton Conway today so I decided to put together a post on his 'game of life' simulator.
Bogo Sort In PHP
I came across this sorting algorithm the other day called 'bogo sort'. This is a sort of joke sorting algorithm that is highly ineffective at actually sorting arrays. The name comes from the word 'bogus'.
Here is how it works.
An Implementation Of Array Binary Search In PHP
I have been doing some reading and watching lectures of programming theory recently and I was reminded of this algorithm I learned about in university. Binary searching an array is a divide and conquer algorithm that takes an array and searches for a value in that array by splitting the array into halves. The algorithm works like this.
Comments
Submitted by Eric on Tue, 05/05/2009 - 15:21
PermalinkSubmitted by giHlZp8M8D on Tue, 05/05/2009 - 15:25
PermalinkSubmitted by kido on Wed, 10/30/2013 - 13:15
PermalinkSubmitted by jell0wed on Tue, 07/01/2014 - 20:57
PermalinkSubmitted by giHlZp8M8D on Wed, 07/02/2014 - 18:45
PermalinkSubmitted by Craig on Mon, 12/22/2014 - 04:28
PermalinkSubmitted by giHlZp8M8D on Tue, 12/23/2014 - 14:13
PermalinkThanks for the arrays. Just FYI, they are never referred to as "states". It's "provinces" and "territories".
Submitted by Christina on Fri, 03/05/2021 - 18:03
PermalinkThanks for pointing that out Christina 🙂
Submitted by giHlZp8M8D on Sat, 03/06/2021 - 08:11
PermalinkAdd new comment