How to test phpversion() and function existence ?
| From: | Olivier Cahagne | Date: | Fri, 24 Nov 2000 17:29:20 +0000 |
| Subject: | How to test phpversion() and function existence ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39104@lists.php.net to get a copy of this message | ||
Hi,
I'd like to know if there's a simple way to test:
- the existence of a function ? For example, does this PHP setup has imap_open() ability ?
This way, I can run my PHP scripts without having an "Error: Undefined function", but rather displaying a message warning some specific package isn't installed.
I really looked at the documentation and only found function_exists() but it's not really related.
- the version number, comparing phpversion() and "4.0.2", when there're functions that only exist with 4.0.2 like wordwrap().
I can test PHP 3 or 4 with floor(phpversion()) but testing 4.0.2 is rather more complicated if you include future test compatibility with v.5, v.4.0.12 on several digits, maybe pl1, etc. is there another PHP version value that can be easily test against ?
Thanks.