Re: [PHP] function_exists question

2009-02-05 Thread Thodoris


Is there a way to check not only if a function exists, but also to 
check that the number and types of parameters desired match a function 
definition?


The reason being that additional options have been added in php 4 and 
5 to various standard function calls, but I'm still running a php3 and 
php4 server in addition to a php5 server.  I would like to make sure 
that certain extended function calls still work in all versions (or 
I'll perform the tasks manually, albeit less efficiently).


One example I can think of is the round() function.  The $precision 
parameter was added in php4, so will not work in php3.  However, 
function_exists would return TRUE for both 3 and 4, but round itself 
would fail if I tried to send a precision level to the php3 server.


Thanks much,
Matt

P.S. Of course the modified function_exists would unfortunately have 
to be a recognized function/method in php3 in order for me to call it 
to check parameter counts on a php3 server :(




I am sure you have some good reasons for keeping php3 right?

Why don't you consider updating to at least php4 ??

PHPv3 is not even maintained and PHPv4 is not being developed any more.

So by the end of this year (I hope) we will start using a stable PHPv6.

IMHO you should consider changing your code (if this is possible) to a 
more mainstream version.


--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function_exists question

2009-02-05 Thread German Geek
Why can't you update to Version 5? I might be a bit anal about trying to
always get the newest version of everything, but seriously version 3 has
surely more known security issues as well as performance costs.

What's the cost of upgrading compared to the cost of writing code that works
in every version? I think upgrading the system to PHP 5 will take you maybe
half an hour, while you can spend a lot more hours on writing backward
compatible code. PHP is not very good with compatibility across versions
anyway. Hopefully all PHP 5 code will work in PHP 6.

How about this PHP developers: You could make a global variable (or
constant) the user can set like

define('PHP_COMPATIBLE_VERSION', '5.0.1');

or something to tell PHP 6 to interpret it like PHP 5.x . That way, at least
you are guaranteed that the code will work like on that version. It might
make PHP 6 (a lot?) bigger but it might be worth the cost, since all Sites
written in PHP will still work. The functions could still have a performance
boost that way if there are better algorithms.

Sorry for steeling the thread.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com


On Fri, Feb 6, 2009 at 12:55 AM, Thodoris t...@kinetix.gr wrote:


  Is there a way to check not only if a function exists, but also to check
 that the number and types of parameters desired match a function definition?

 The reason being that additional options have been added in php 4 and 5 to
 various standard function calls, but I'm still running a php3 and php4
 server in addition to a php5 server.  I would like to make sure that certain
 extended function calls still work in all versions (or I'll perform the
 tasks manually, albeit less efficiently).

 One example I can think of is the round() function.  The $precision
 parameter was added in php4, so will not work in php3.  However,
 function_exists would return TRUE for both 3 and 4, but round itself would
 fail if I tried to send a precision level to the php3 server.

 Thanks much,
 Matt

 P.S. Of course the modified function_exists would unfortunately have to
 be a recognized function/method in php3 in order for me to call it to check
 parameter counts on a php3 server :(


 I am sure you have some good reasons for keeping php3 right?

 Why don't you consider updating to at least php4 ??

 PHPv3 is not even maintained and PHPv4 is not being developed any more.

 So by the end of this year (I hope) we will start using a stable PHPv6.

 IMHO you should consider changing your code (if this is possible) to a more
 mainstream version.

 --
 Thodoris



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] function_exists question

2009-02-05 Thread Boyd, Todd M.
 -Original Message-
 From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of
 German Geek
 Sent: Thursday, February 05, 2009 5:02 PM
 To: t...@kinetix.gr
 Cc: Matt Pagel; php-general@lists.php.net
 Subject: Re: [PHP] function_exists question
 
 Why can't you update to Version 5? I might be a bit anal about trying
 to
 always get the newest version of everything, but seriously version 3
 has
 surely more known security issues as well as performance costs.
 
 What's the cost of upgrading compared to the cost of writing code that
 works
 in every version? I think upgrading the system to PHP 5 will take you
 maybe
 half an hour, while you can spend a lot more hours on writing backward
 compatible code. PHP is not very good with compatibility across
 versions
 anyway. Hopefully all PHP 5 code will work in PHP 6.
 
 How about this PHP developers: You could make a global variable (or
 constant) the user can set like
 
 define('PHP_COMPATIBLE_VERSION', '5.0.1');
 
 or something to tell PHP 6 to interpret it like PHP 5.x . That way, at
 least
 you are guaranteed that the code will work like on that version. It
 might
 make PHP 6 (a lot?) bigger but it might be worth the cost, since all
 Sites
 written in PHP will still work. The functions could still have a
 performance
 boost that way if there are better algorithms.
 
 Sorry for steeling the thread.
 
 Regards,
 Tim
 
 Tim-Hinnerk Heuer
 
 http://www.ihostnz.com
 
 
 On Fri, Feb 6, 2009 at 12:55 AM, Thodoris t...@kinetix.gr wrote:
 
 
   Is there a way to check not only if a function exists, but also to
 check
  that the number and types of parameters desired match a function
 definition?
 
  The reason being that additional options have been added in php 4
 and 5 to
  various standard function calls, but I'm still running a php3 and
 php4
  server in addition to a php5 server.  I would like to make sure
that
 certain
  extended function calls still work in all versions (or I'll
 perform the
  tasks manually, albeit less efficiently).
 
  One example I can think of is the round() function.  The $precision
  parameter was added in php4, so will not work in php3.  However,
  function_exists would return TRUE for both 3 and 4, but round
itself
 would
  fail if I tried to send a precision level to the php3 server.
 
  Thanks much,
  Matt
 
  P.S. Of course the modified function_exists would unfortunately
 have to
  be a recognized function/method in php3 in order for me to call it
 to check
  parameter counts on a php3 server :(
 
 
  I am sure you have some good reasons for keeping php3 right?
 
  Why don't you consider updating to at least php4 ??
 
  PHPv3 is not even maintained and PHPv4 is not being developed any
 more.
 
  So by the end of this year (I hope) we will start using a stable
 PHPv6.
 
  IMHO you should consider changing your code (if this is possible) to
 a more
  mainstream version.

I think it would be much easier to run several versions of PHP in tandem
on the same server, and let an .htaccess file (or some other such
convention) determine the version of PHP to run particular
files/directories/etc. with.

My 2c,


// Todd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function_exists question

2009-02-05 Thread Chris



How about this PHP developers: You could make a global variable (or
constant) the user can set like

define('PHP_COMPATIBLE_VERSION', '5.0.1');

or something to tell PHP 6 to interpret it like PHP 5.x . That way, at least
you are guaranteed that the code will work like on that version. It might
make PHP 6 (a lot?) bigger but it might be worth the cost, since all Sites
written in PHP will still work. The functions could still have a performance
boost that way if there are better algorithms.


php5 introduced this:

http://au.php.net/manual/en/ini.core.php#ini.zend.ze1-compatibility-mode

to make sure php5 interpreted php4 code in a b/c way, they may do 
something similar for php6 - php5.


Doing it at runtime is silly imo.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php