PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
in the below code, both the echo statements gives the error. Parse error: syntax error, unexpected '['.
How to write the code using val not $val without giving the error so that val['archive_days'] would work?
I dont really understand what are you trying to do, but this is the way to work with arrays: http://php.net/manual/en/language.types.array.php
And you cant print an Array, you need to print the Placeholders by a loop.
I am still trying to understand this line of code. Why val is used instead of $val. also what is -> in the code. note the code works great. I am just trying to understand it fully.
stevestark5000 wrote:I am still trying to understand this line of code. Why val is used instead of $val. also what is -> in the code. note the code works great. I am just trying to understand it fully.
$_SESSION is an array and ['SES_ART_master'] is an element of that array that contains an object with a property called val which is an array that has an element called ['archive_days']. The -> is how you access properties and methods of an object:
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
what i was also asking for is how to output val instead of $val and without an error. I found a solution.
echo $_SESSION['SES_ART_master']->val['archive_days']