![]() |
PHP Guru -- here's a tough one!
1) Why can't I use '$this' since when $func() is executed it will be in foo's object context ? (So $this should be available ?!)
2) How can I avoid this problem ? (cause I really need to call a function from class foo) Quote:
|
it's late for me, but isn't it
foo::internal(); |
foo::internal(); would work except for the fact that I really need $this because internal() normally use $this->properties...
I've oversimplified my example. Sorry. This would be more accurate : Quote:
I also tryed call_user_func_array(array($f, 'bar'), array()); instead of $f->bar without success Thanks for you help... specially at this hour. |
What version of PHP are you using?
|
php 5.3.0
|
I can't even do anonymous functions as none of my php versions are 5.3 or above.
Are you getting an error or is just not working? If error, what line is giving you the error? |
Ok it's possible to do this :
Quote:
|
bump 8char
|
I'm not a programmer, just a sysadmin, but perhaps it relates to register_globals being disabled?
|
can't help really as I'm on 5.2.x, so all this isn't available, but according to http://php.net/manual/en/migration53.incompatible.php
Quote:
scroll down to user comment by chris at NOSPAM dot panospheric dot com 23-Sep-2007 02:37 this looks like what you are trying to do? hope it helps |
Quote:
Ultimately what I would like to do is something like this : Quote:
|
Then use: $response = exec($code);
And what's the reason for you complicating shit beyond belief? |
Quote:
LOL it's complicated I'll give you that! but in my application users can inject their own code into my predefined objects. Lets say for overriding a behavior that doesn't fit their business rules ... thanks for your help. |
that's a tuffy ... :xmas-smil22
|
Here we go !
Thanks everyone for your help ! Code:
class foo{ |
All times are GMT -7. The time now is 06:40 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123