Using PHP 'define' in Phalanger

Discussion about the open-source Phalanger [?] project.

Using PHP 'define' in Phalanger

Postby MX26 » May 23rd, 2014, 2:16 am

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!
MX26
 
Posts: 18
Joined: May 14th, 2014, 4:49 pm

Re: Using PHP 'define' in Phalanger

Postby Jakub Misek » May 26th, 2014, 2:45 pm

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 1 guest