<?php

function add1($a) {
	return $a + 1;
}

function mul0_5($a) {
	return $a * 0.5;
}

function COMPOSE($f, $g) {
  return function() use ($f,$g) {
    $args = func_get_args();
    return $g(call_user_func_array($f, $args));
  };
}

$compose1 = COMPOSE("add1", "mul0_5");
$compose2 = COMPOSE("intval", $compose1);

printf("%f", $compose2("1"));