# #define for zend engine 2.1

- Thread: https://externals.io/message/14685
- Original archive: https://news-web.php.net/php.internals/14685
- Started by val khokhlov on 2005-02-07T12:09:40+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #14685 — val khokhlov — 2005-02-07T12:09:40+00:00

URL: https://externals.io/message/14685#14685

Hello internals,

       is there a way to find out version of zend engine (2 or 2.1)?
       i need it in the code like this:
#if defined(ZEND_ENGINE_2_1)
    ZEND_VM_SET_OPCODE_HANDLER(zo);
#elif defined(ZEND_ENGINE_2)
    zo->handler = zend_opcode_handlers[zo->opcode];
#endif

       unfortunately, zend.h contains only these version-related defines:
#define ZEND_VERSION "2.1.0-dev"
#define ZEND_ENGINE_2
       maybe, there's some other #define that can be used to tell ze2.0 from
ze2.1?
  

-- 
Best regards,
 val                          mailto:val@vk.kiev.ua

---

## #14686 — Derick Rethans — 2005-02-07T12:42:49+00:00

URL: https://externals.io/message/14685#14686 · In reply to: #14685

>        is there a way to find out version of zend engine (2 or 2.1)?
>        i need it in the code like this:
> #if defined(ZEND_ENGINE_2_1)
>     ZEND_VM_SET_OPCODE_HANDLER(zo);
> #elif defined(ZEND_ENGINE_2)
>     zo->handler = zend_opcode_handlers[zo->opcode];
> #endif

#if `PHP_MAJOR_VERSION` == 5 && `PHP_MINOR_VERSION` >= 1

works ;-)

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #14687 — M. Sokolewicz — 2005-02-07T13:07:47+00:00

URL: https://externals.io/message/14685#14687 · In reply to: #14686

Derick Rethans wrote:
> 
> 
> 
> > […]
> 
> 
> #if `PHP_MAJOR_VERSION` == 5 && `PHP_MINOR_VERSION` >= 1
> 
> works ;-)
> 
> Derick
> 
wouldn't
#if `PHP_MAJOR_VERSION` >= 5 && `PHP_MINOR_VERSION` >= 1
be better in case this code would ever be used with a hypothetical PHP 
version 6? ;)

- tul

---

## #14688 — Derick Rethans — 2005-02-07T13:10:41+00:00

URL: https://externals.io/message/14685#14688 · In reply to: #14687

> > […]
>
> wouldn't
> #if `PHP_MAJOR_VERSION` >= 5 && `PHP_MINOR_VERSION` >= 1
> be better in case this code would ever be used with a hypothetical PHP
> version 6? ;)

No - then it wouldn't be triggered for PHP 6.0.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #14689 — messju mohr — 2005-02-07T13:10:59+00:00

URL: https://externals.io/message/14685#14689 · In reply to: #14687

[...]
> wouldn't
> #if `PHP_MAJOR_VERSION` >= 5 && `PHP_MINOR_VERSION` >= 1
> be better in case this code would ever be used with a hypothetical PHP 
> version 6? ;)
>
 > - tul

no, it wouldn't. it would work with 6.1, but not with 6.0

messju

---

## #14690 — Marcus Boerger — 2005-02-07T13:48:49+00:00

URL: https://externals.io/message/14685#14690 · In reply to: #14687

Hello M.,

 as found in SRM the correct code is:

#if (PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && `PHP_MINOR_VERSION` >= 1)

regards
marcus

Monday, February 7, 2005, 2:07:47 PM, you wrote:

> Derick Rethans wrote:
> > […]
> wouldn't
> #if `PHP_MAJOR_VERSION` >= 5 && `PHP_MINOR_VERSION` >= 1
> be better in case this code would ever be used with a hypothetical PHP 
> version 6? ;)

> - tul




-- 
Best regards,
 Marcus                            mailto:helly@php.net
