According to many sources, register_globals (global variables that is) should be disables in your php.ini.
Should I write define() in my code and use constants if global variables are disabled? Are those even related?
...
I am getting this error in a PHP class...
Fatal error: Can't use method return
value in write context in
C:\webserver\htdocs\friendproject2\includes\classes\User.class.php
on line 35
Here is the troubled part.
if(isset($this->session->get('user_id')) && $this->session->get('user_id') != ''){
//run code
}
This code is...
I am curious, is there any performance gain, like using less memory or resources in PHP for:
50 different setting variables saved into array like this
$config['facebook_api_secret'] = 'value here';
Or 50 different setting variables saved into a Constant like this
define('facebook_api_secret', 'value here');
...
What is the significance of the positioning of the
const
keyword when declaring a variable in Objective-C, for example:
extern const NSString * MY_CONSTANT;
versus
extern NSString * const MY_CONSTANT;
Using the first version in assignments produces warnings about "qualifiers from pointer target type" being discarded so I'm assum...
Is a global PHP CONSTANT available inside of a Class file?
define('SITE_PATH', 'C:/webserver/htdocs/somefolder/');
Then in my class file I try this
public $debug_file = SITE_PATH. 'debug/debug.sql';
This does not seem to work though,
Parse error: parse error, expecting
','' or';'' in
C:\webserver\htdocs\somefolder\inclu...
Hi there,
I'm a programming student in my 2nd OOP course, which is taught in C++. I know that it is generally bad practice to use magic numbers in code, so here's my question:
In the next program I have to write for this class, there is over 120 numbers given to us in tax tables, and we need to use them to compute tax and other relevan...
I need to loop a const char, and I've used a simple example of string loop:
const char *str;
for(int i = 0; i < 10; ++i)
{
str += " ";
}
But when I tried to compile, I got this:
ubuntu@eeepc:~/Test_C_OS$ gcc -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs
kernel.c:26: error: ‘for’ loop initial dec...
When I run in hosted mode, it able to get the result.
But when I deploy it to tomcat then I cant get the result at all.
Anyone can tell me what is the problem??
public class Customwidget implements EntryPoint {
private static final SystemConfig constants = (SystemConfig)GWT.create(SystemConfig.class);
public void onModuleLoad() {...
I'm just starting with X++ (Java background) and I found a code like
#XYZBatchScheduling
;
...
order.Status = #geplant;
order is a record to a table with a Status column.
My question: what is the meaning of #USRBatchScheduling and #geplant ("geplant" is "planned" in german) and eventually where to find it's definition.
I suppose it...
In C#, the following type-inference works:
var s = "abcd";
But why can't the type be inferred when the variable is a constant?
The following throws a compile-time exception:
const var s = "abcd"; // <= Compile time error:
// Implicitly-typed local variables cannot be constant
...
Does .NET have a constant for the number of seconds in a day (86400)?
...
I was looking at some example C++ code for a hardware interface I'm working with and noticed a lot of statements along the following lines:
if ( NULL == pMsg ) return rv;
I'm sure I've heard people say that putting the constant first is a good idea, but why is that? Is it just so that if you have a large statement you can quickly see ...
I'm trying to save a timestamp into a constant at the beginning of a program's execution to be used throughout the program. For example:
Const TIME_STAMP = Format(Now(), "hhmm")
However, this code generates a compiler error - "Constant expression is required." Does that mean all constants in VB .NET have to contain flat, static, hard-c...
I want a header file with a non-integral constant in it, e.g. a class. Note the constant does not need to be a compile-time constant.
static const std::string Ten = "10";
This compiles but is undesirable as each compilation unit now has its own copy of Ten.
const std::string Ten = "10";
This will compile but will fail with a linke...
Will it downgrade performance significantly (or exhaust the server with http requests), or maybe ill advised, to do something like this
echo "<span>enter_username_message</span>";
and centralize this constant along with all output messages in one file, so that those could be changed without getting into the code:
define('enter_userna...
Isn't PHP suppose to show an error is you call a non-existent CONSTANT? When I run the code below for a constant that is not defined, it shows on the screen "TEST" instead of any kind of error. Could I have a setting wrong in my php.ini file or is this something new? Im running PHP 5.3
<?php
echo TEST;
?>
...
I am using the DateTime.ToFileTime and FromFileTime methods to store and retrieve timestamps in a database. The mininum windows file time is midnight, Jan 1, 1601. Is there a constant similar to DateTime.MinValue, that describes this value?
...
i.e., would the following be expected to execute correctly even in a multithreaded environment?
int dostuff(void) {
static int somevalue = 12345;
return somevalue;
}
Or is it possible for multiple threads to call this, and one call to return whatever garbage was at &somevalue before execution began?
...
I have a set of constants declared in Perl:
use constant C1 => 111;
use constant C2 => 222;
..
use constant C9 => 999;
my $which_constant = "C2";
How do I construct a Perl expression which, based on $which_constant, derives the value of a constant named with the value of this variable - e.g. "222".
Please note that I c...
I have about 20 files containing 10-15 times this:
define('someConstantName','stringBetween10and200Chars');
those are all critical for the app, but each constants-file is parallel to an app page.
For example, index.php will require index_constants.php so on so forth.
The question is, should I make one file of all constant-definition...