Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Closures, lambdas and namespaces in PHP 5.3

Name: Anonymous 2008-08-23 7:38

ttp://www.php.net/archive/2008.php#id2008-08-01-1

I have a dream that one day PHP will be a respectable programming language.

I have a dream that one day we'll download popular web applications that are free software and will not be outraged at their source code.

I have a dream that one day "designers" who were writing PHP would just give up and we'll get less PHP-Nuke hacks, and more decent software.

I have a dream today.

Name: Anonymous 2008-08-24 0:00

#include <stdio.h>

#define MAKE_FUNC(block, return_type, first_arg_type) ({\
  return_type _f(first_arg_type __, ...){\
   return (block);\
  }\
  &_f;\
 })

int main(){
 int (*mult_by_2)(int, ...) = MAKE_FUNC({__ * 2;}, int, int);
 for(int i = 0; i < 10; ++i)
  printf("mult_by_2(%d) = %d\n", i, mult_by_2(i));
 return 0;
}


C >>> PHP

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List