Hello Zephir Folks,
I'm just getting started with Zephir, and I'm using it to re-write some functionality in my company's portal framework. I'm looking to see what kind of performance increases we might be able to get from porting PHP to Zephir.
Right now I'm trying to keep the structure of the code as similar as possible between the PHP version and the Zephir version, but there's two things I can't quite seem to figure out.
- Static Class Properties via Variable Variables
Part of our code uses variable variables to reference static properties, like so:
<?php $someVar = 'someValue'; // Set self::$someValue to 'foo' self::$$someVar = 'foo';
I didn't see a way to do this using Zephir without having to do some voodoo with the Reflection class. The list of properties being accessed like this is a known set, so I'll be rewriting this portion eventually (I imagine variable variables aren't friendly for optimization), but I'd like to keep the Zephir and the PHP as close as possible for the first round of tests.
- Accessing Variables From Included Files
Our current framework stores configuration values in arrays, which are stored in files based on the environment / system / etc. They're pretty simple and look like this:
<?php $config = array( 'key' => 'value', 'key2' => 'value2' );
I'm able to include these files with Zephir, but I can't quite seem to figure out how to easily access the $config value once the file is included. I can make a call to get_defined_vars() and fetch the value that way, but it doesn't seem very elegent. Is there a better way to do this?
Many thanks for any help you can provide.