Question: In JavaScript you can have:

```
var blabla = function(arg){
  ...
};

```

Is there something like this in PHP?

I know about `create_function()`, but it's really complicated to stuff your code in a string argument.

Answer: 
Since PHP 5.3 you can create anonymous functions like this:

```
$var = 1;
$func = function( $arg ) use ($var) {
     return $arg + $var;
};

```

The `use` clause is required to access variables defined outside the anonymous function.

If you want to change an outside variable in the anonymous function you have to declare it as an reference (by adding an `&` in front of the `$`) in the `use` part:

```
$var = 1;
$func = function() use ( &$var ) {
   $var = 42;
}
$func();
// $var == 42 now

```

Otherwise changes made in the anonymous function will not be propagated to the outside.
Anonymous functions are available since PHP 5.3.0. [link](http://php.net/manual/en/functions.anonymous.php)