We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Is supported "Include" statement on Zephir ?

I'm trying the Zephir compiler out. Is supported "include" statement ?

my Zephir code is..

namespace Dumy;
final class Mage{
    public static function renderHtml(){
        include("/var/www/magento/include/b.php");
    }
}

but, it doesn't work.

$ zephir compile

Warning: Function "include" does not exist at compile time in /var/www/magento/temp/dumy/dumy/mage.zep on 5 [nonexistant-function]

thanks.



98.9k

No, "include" is not supported, "require" will be supported but it is still not implemented

edited Jan '18

Seems require is still not implemented :s, needed for an RPC thing im doing.. there is a work-around.

Use eval()

    // load and eval class (include, require not supported "yet")
    var src = file_get_contents("/path/to/file.php");
    eval("?>" . src);

Whoops, sorry maybe wrong forum, came from a google search zephir include php