note 77209 modified in function.create-function by danbrown

From: Date: Sat, 19 Jul 2008 21:18:36 +0000
Subject: note 77209 modified in function.create-function by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141752@lists.php.net to get a copy of this message
In response to koyama at hoge dot org (14-Dec-2000): This does NOT create a new method - try adding this at the end: <?php if (function_exists($h->lamda)) { print "Its a function\n"; } else { print "No it isnt"; } ?> It creates a function which $h->lamda points to. Under PHP4 you could simply add an argument $this which meant it *behaved* like a method (though it existed in global scope) but with PHP5, you can't have a variable named $this in a function (which is rather irksome). (and methinks the ant-bot challenge is taking the mickey - min(three, four)? !). --was-- In response to koyama at hoge dot org (14-Dec-2000): This does NOT create a new method - try adding this at the end: if (function_exists($h->lamda)) { print "Its a function\n"; } else { print "No it isnt"; } It creates a function which $h->lamda points to. Under PHP4 you could simply add an argument $this which meant it *behaved* like a method (though it existed in global scope) but with PHP5, you can't have a variable named $this in a function (which is rather irksome). (and methinks the ant-bot challenge is taking the mickey - min(three, four)? !). http://php.net/manual/en/function.create-function.php

« previous php.notes (#141752) next »