Hi,
I'm trying to assign values to an array by evaluating expressions like so:
$myArray = (
'sessionMaxInactive' =60*5,
'persistentMaxTime' =60*60*24*30
);
This doesn't seem to work. I've tried surrounding them with the brackets and
double quotes too, to no avail. Sould this be possible in php? If so, what
am I missing?
Thanks. 9 1826
On Sun, 13 Aug 2006 22:23:47 +0200, "amygdala" <no*****@noreply.comwrote:
>I'm trying to assign values to an array by evaluating expressions like so:
$myArray = (
'sessionMaxInactive' =60*5,
'persistentMaxTime' =60*60*24*30 );
This doesn't seem to work.
In what way does it "not seem to work"?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
"Andy Hassall" <an**@andyh.co.ukschreef in bericht
news:vs********************************@4ax.com...
On Sun, 13 Aug 2006 22:23:47 +0200, "amygdala" <no*****@noreply.com>
wrote:
>>I'm trying to assign values to an array by evaluating expressions like so:
$myArray = ( 'sessionMaxInactive' =60*5, 'persistentMaxTime' =60*60*24*30 );
This doesn't seem to work.
In what way does it "not seem to work"?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Hi Andy,
It gives me:
Parse error: parse error, unexpected '*', expecting ')'
Any ideas?
Cheers
I'm trying to assign values to an array by evaluating expressions like so:
>
$myArray = (
'sessionMaxInactive' =60*5,
'persistentMaxTime' =60*60*24*30
);
This doesn't seem to work. I've tried surrounding them with the brackets and
double quotes too, to no avail. Sould this be possible in php? If so, what
am I missing?
There is no chance to work for it. Simply, there is a syntax error. It
should be:
$myArray = array( 'sessionMaxInactive' =60*5, 'persistentMaxTime' =>
60*60*24*30 );
There is no chance to work for it. Simply, there is a syntax error. It
should be:
$myArray = array( 'sessionMaxInactive' =60*5, 'persistentMaxTime' =>
60*60*24*30 );
Yes you are right of course. Typo on my part in my message. But in my
original script I have that. Now I am confused though:
The full array is this (part of a session class):
private $config = array(
'sessionTable' =DB_TABLE_SESSIONS,
'userTable' =DB_TABLE_USERS,
'persistentMaxTime' =60*60*24*30,
'sessionMaxInactive' =60*30,
'regenerateId' =true,
'idRegenerationInterval' =10,
'cookieName' ='PHPSESSION',
'cookiePath' ='/',
'checkIp' =true,
'checkAgent' =true
);
which yields the error:
Parse error, parse error, unexpected '*', expecting ')' on line 49 (which is
the line of 'persistentMaxTime')
But this script seems to work fine indeed:
<?php
error_reporting( E_ALL );
$myArray = array( 'sessionMaxInactive' =60*5, 'persistentMaxTime' =>
60*60*24*30 );
echo $myArray[ 'sessionMaxInactive' ];
?>
"amygdala" <no*****@noreply.comwrote:
The full array is this (part of a session class):
private $config = array(
'sessionTable' =DB_TABLE_SESSIONS,
'userTable' =DB_TABLE_USERS,
'persistentMaxTime' =60*60*24*30,
'sessionMaxInactive' =60*30,
'regenerateId' =true,
'idRegenerationInterval' =10,
'cookieName' ='PHPSESSION',
'cookiePath' ='/',
'checkIp' =true,
'checkAgent' =true
);
which yields the error:
Parse error, parse error, unexpected '*', expecting ')' on line 49 (which is
the line of 'persistentMaxTime')
That's an invalid syntax: the default value of a class property must be
a static_scalar, that is a simple number, a string or an array of these
items. Other expressions are not allowed.
Here is a chunk from the EBNF syntax of PHP 5:
static_scalar = common_scalar
| T_STRING
| "+" static_scalar
| "-" static_scalar
| "array" "(" [static_array_pair_list] ")"
| static_class_constant ;
static_array_pair_list = static_array_pair { "," static_array_pair } [","] ;
static_array_pair = static_scalar ["=>" static_scalar] ;
Check the official BNF syntax Zend/zend_language_parser.y
( http://www.icosaedro.it/articoli/php-syntax-yacc.txt)
or the equivalent EBNF syntax translated by me from that file
( http://www.icosaedro.it/articoli/php-syntax-ebnf.txt)
So, expressions like "60*30" aren't allowed. Use "1800" instead.
Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it
"Umberto Salsi" <sa***@icosaedro.italiaschreef in bericht
news:eb**********@nnrp.ngi.it...
"amygdala" <no*****@noreply.comwrote:
>The full array is this (part of a session class):
private $config = array( 'sessionTable' =DB_TABLE_SESSIONS, 'userTable' =DB_TABLE_USERS, 'persistentMaxTime' =60*60*24*30, 'sessionMaxInactive' =60*30, 'regenerateId' =true, 'idRegenerationInterval' =10, 'cookieName' ='PHPSESSION', 'cookiePath' ='/', 'checkIp' =true, 'checkAgent' =true );
which yields the error:
Parse error, parse error, unexpected '*', expecting ')' on line 49 (which is the line of 'persistentMaxTime')
That's an invalid syntax: the default value of a class property must be
a static_scalar, that is a simple number, a string or an array of these
items. Other expressions are not allowed.
Clear! Thanks.
Here is a chunk from the EBNF syntax of PHP 5:
static_scalar = common_scalar
| T_STRING
| "+" static_scalar
| "-" static_scalar
| "array" "(" [static_array_pair_list] ")"
| static_class_constant ;
static_array_pair_list = static_array_pair { "," static_array_pair } [","]
;
static_array_pair = static_scalar ["=>" static_scalar] ;
Check the official BNF syntax Zend/zend_language_parser.y
(http://www.icosaedro.it/articoli/php-syntax-yacc.txt)
or the equivalent EBNF syntax translated by me from that file
(http://www.icosaedro.it/articoli/php-syntax-ebnf.txt)
Eehh, thanks for the suggestions, but I think I'll pass trying to grasp
what's going on in those files ;)
On Sun, 13 Aug 2006 22:23:47 +0200, amygdala wrote:
f so, what
am I missing?
Keyword "array".
-- http://www.mgogala.com
Hi,
>
I'm trying to assign values to an array by evaluating expressions like so:
$myArray = (
'sessionMaxInactive' =60*5,
'persistentMaxTime' =60*60*24*30
);
This doesn't seem to work. I've tried surrounding them with the brackets and
double quotes too, to no avail. Sould this be possible in php? If so, what
am I missing?
this wont work either inside a class. Seems like a serious problem to
me.
class foo {
private $xyz = 2 * 3;
}
this wont work either inside a class. Seems like a serious problem to
me.
class foo {
private $xyz = 2 * 3;
}
Yeah seems pretty odd to me too. I wonder what the reason for this approach
is. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Spiegel |
last post by:
Hi all,
Is it possible to have an uncompiled C# expression evaluated at runtime?
I'd like to store an expression within an XML file then evaluate it when the
time comes, something like:
...
|
by: Zeng |
last post by:
Hello,
I just wonder if there is a way to programmatically evaluate expression
strings such as
( ( 3 + 5 ) / 2 ) > 4 --> this should return 0 or false
( ( 3 + 6 ) / 3 ) > ( ( 5 + 3 ) / 4 ) ...
|
by: SubasreeG |
last post by:
Hi,
I have a situation where expression to evaluate comes from the user. I have to execute the expression and based upon the result i have to perform certain operation. The problem is that the...
|
by: steevehetu18 |
last post by:
Hi,
I'm doing a algorithm to calcule Earliest Start et Latest Start for a
Graph with Nodes and Arcs. (like a PERT diagram) . Unfortunatly, i
receive a wierd exception message for a specific...
|
by: Rick Little |
last post by:
While stepping through code, I've started getting this message when tying to
see the value of most variables.
Cannot evaluate expression because a thread is stopped at a point where
garbage...
|
by: Ajit Goel |
last post by:
Hi;
My project file property is set to use "Visual Studio Development
Server". I am able to debug and see the corresponding values when I
mouseover but as soon as I change to the project file...
|
by: Glenn |
last post by:
OK, I've looked up this message but am not finding how to get rid of
it: "Cannot evaluate expression because a thread is stopped at a point
where garbage collection is impossible, possibly because...
|
by: tbh |
last post by:
in an error path in an aspx script under DotNet 2, IIS6, Win2003 Server I
get the following error (which I don't understand) on Respone.End():
{Unable to evaluate expression because the code is...
|
by: jagdeep gupta |
last post by:
The code was executing fine but now an exception is generated: "exc = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"
...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
| |