By combinations algorithm I mean code that will produce output similar to the example below.
I found the C implementation by Knuth already but it used the "goto" statement. PHP 5.2.4 (the version of PHP I must use) does not support "goto". So when I port it to PHP it will error on the goto statments. I could modify it further but I think I might loose efficiency.
Or if not a PHP implementation perhaps an implementation that is not too object-oriented(so that the actual algorithm is not hidden) or an implementation that does not use "goto".
Example: nCr, n=3, r=2
3C2 =
{1,2},{1,3},{2,3}