Infinite loops

We all know what a loop is: a programming language statement that allows us to repeat the execution of a piece of code until a certain ending condition is met. If the ending condition is never met or it does not exist at all, the loop never ends: that’s an infinite loop (also known as . . . → Read More: Infinite loops

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 number . . . → 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…

Categories

Archives

Calendar

September 2014
M T W T F S S
« Jul    
1234567
891011121314
15161718192021
22232425262728
2930