Page 1 of 1

Using PHP 'define' in Phalanger

PostPosted: May 23rd, 2014, 2:16 am
by MX26
I need to define some constants in a Phalanger class. For example:
define("HEADER", TRUE)

When I compile the class, I get a compiler error along the lines of 'define is not recognized'.

What am I missing here?

Thanks!

Re: Using PHP 'define' in Phalanger

PostPosted: May 26th, 2014, 2:45 pm
by Jakub Misek
Hi,

"define" is a functions declared in PhpNetClasslibrary.dll. Ensure this extension is referenced (it should be by default unless you have broken machine.config file) In your app.config or web.config or machine.config (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config and C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config) should be following piece of configuration at the end of the file:
Code: Select all
<phpNet>
    <classLibrary>
      <add assembly="PhpNetClassLibrary, Version=4.0.0.0, Culture=neutral, PublicKeyToken=4af37afe3cde05fb"/>


BTW you can define constants using 'const' keyword.

Thanks,