Jump to content

define help...


eric1235711

Recommended Posts

Huh! With the following code:
[code=php:0]define('TEST', 'test is' . ($test? ' ': ' not ') . 'ok');
echo TEST;[/code]

PHP will define TEST as "test is ok" if the variable $test exists or holds a boolean that is true, is a string or a number etc. If $test was set to a boolean that is false, null or not a string/number etc it'll define TEST as "test is not ok".

When ever you initiate define('VAR_NAME', blah blah) PHP will define the constant VAR_NAME with whats in the secound parameter.

If you have ten files that has 100 defines it will only define 100 constants at a time as you can only run one file at a time, unless you include the other 9 files.
Link to comment
Share on other sites

Here where I´m working there are is a single functions file called 'general.php' with more than 9000 lines. It also includes other function files...  Lips sealed

There are almost all the functions (not general functions are there too)...

won´t it overcharge the server or will it not do a lot of useless processing? And won´t it put a lot of trash in the server´s memory?
Link to comment
Share on other sites

Not really no as PHP doesnt load the pages into memery. It just parses php code in the php files. Whne its done parsing the script it releases any memory being used back to the system, this is why variables/constants only work on the file they where created on. PHP only runs on a per-request basis, meaning it'll only run when a client (web browser) request the server for the desiered PHP file.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.