You are here: Re: evaluate expression inside array « PHP Programming Language « IT news, forums, messages
Re: evaluate expression inside array

Posted by amygdala on 12/17/86 11:55

> 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' ];
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация