Skip to content
Browse files

Registering a PHP_PYTHON_VERSION constant that contains the extension's

version string.  We use this in our shell example.
  • Loading branch information...
1 parent e979783 commit 3d1759dbb2320029aab366cc4097a89dc47abf0a @jparise committed Sep 22, 2008
Showing with 5 additions and 1 deletion.
  1. +2 −1 examples/shell.php
  2. +3 −0 python.c
View
3 examples/shell.php
@@ -1,6 +1,7 @@
<?php
-echo 'Python in PHP (' . python_version() . ")\n";
+echo "Python in PHP (" . PHP_PYTHON_VERSION . ")\n";
+echo python_version() . "\n";
$stdin = fopen('php://stdin', 'r');
View
3 python.c
@@ -110,6 +110,9 @@ PHP_MINIT_FUNCTION(python)
ZEND_INIT_MODULE_GLOBALS(python, python_init_globals, NULL);
REGISTER_INI_ENTRIES();
+ REGISTER_STRING_CONSTANT("PHP_PYTHON_VERSION", PHP_PYTHON_VERSION,
+ CONST_CS | CONST_PERSISTENT);
+
INIT_CLASS_ENTRY(ce, "Python", NULL);
python_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
python_class_entry->create_object = python_object_create;

0 comments on commit 3d1759d

Please sign in to comment.
Something went wrong with that request. Please try again.