Swapping two variables in PHP

In my last post at some point in the code I had to do a variable swap (to assign the value of the second variable to the first and vice-versa). To do this I used a third temporary variable to hold the content of the first variable so it’s value won’t be lost.

$temp . . . → Read More: Swapping two variables in PHP

PHP function to generate all permutations

To generate all permutations of a given set means to find all possible ways the elements of the set can be arranged. For example, if the given set is {1, 2, 3} the permutations are:

1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1

The . . . → Read More: PHP function to generate all permutations

Removing accents from strings in PHP

A simple method for removing accents from strings in PHP:

1 2 $x = strtr($x, "ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");

And so you code…

Polybius cipher

Polybius cipher is a basic form of encryption invented by the Ancient Greek Historian whose name it bears. It is based on fractionating plaintext characters so they can be represented by a smaller set of symbols. In plain English: all the letters of the alphabet are written in a 5×5 square like the one . . . → Read More: Polybius cipher

Categories

Archives

Calendar

January 2012
M T W T F S S
« May    
 1
2345678
9101112131415
16171819202122
23242526272829
3031