473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Syntax not allowed

The following is not allowed (simplified for this forum): but it seems
reasonable to me. Could some one explain mw lack of insight?

$t = (array(1=>"Sold", 3=>"Transit"))[$location_id];

Parse error: parse error, unexpected '[' in
/var/www/html/GEM-is/batchJobs/sales.php on line 183
Feb 26 '06 #1
3 1305
The parser can't handle such syntax, that's all.

Feb 26 '06 #2
Greetings,

This is the standard syntax to build a PHP array:

$myArray = array('index1' => 'val1', 'index2' => 'val2', 'index3' =>
'val3');

To create a multidimensional array you could use something like this:

$myArray = array("A" => array("a", "b", "c" => array("x")), "B" =>
"y");

Not sure if this is close to what you are looking for

- Peter Schmalfeldt
Manifest Interactive

Feb 26 '06 #3
"Manifest Interactive" <ma*****************@gmail.com> wrote:
Greetings,

This is the standard syntax to build a PHP array:

$myArray = array('index1' => 'val1', 'index2' => 'val2', 'index3' =>
'val3');

To create a multidimensional array you could use something like this:

$myArray = array("A" => array("a", "b", "c" => array("x")), "B" =>
"y");

Not sure if this is close to what you are looking for


Not at all. He was trying to create a temporary array and reference an
element of it without saving to a variable. I, also, am surprised this
doesn't work.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Feb 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Ike | last post by:
I am hoping someone can help me with the proper syntax for this. I have an attribute, called, say "name," such that: <set name="something">thename</set> However, the value for name, is...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
8
by: Rich | last post by:
Hello, If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a...
0
by: Travis Oliphant | last post by:
This post is to gather feedback from the wider community on PEP 357. It is nearing the acceptance stage and has previously been discussed on python-dev. This is a chance for the wider Python...
21
by: Dmitry Anikin | last post by:
I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload...
0
by: Stef Mientki | last post by:
hello, I've syntax error which I totally don't understand: ########## mainfile : import test_upframe2 if __name__ == '__main__': var1 = 33 code = 'print var1 + 3 \n'
0
by: Terry Reedy | last post by:
Stef Mientki wrote: Indendation is screwed. Is the above all do_more body? Which locals does this get you? __init__'s? (locals()?) Isn't this just the same as globals()?
6
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
double c = double.NaN; Console.WriteLine(c = 10); Console.WriteLine(c += 5); Console.WriteLine(c); output: 10 15 15
14
by: paresh | last post by:
Is this the valid C statement. int a,b,c; c = 5; <<< a = b = c; Can anyone throw the light on this. -Paresh
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.