Hi, I want to make an array with only indexes no values, it is possible to do something like this
$validfields['name'];
$validfields['age'];
or will the sytax be
$validfields['name']="";
$validfields['age']="";
simple array question
Moderator: General Moderators
or simply...
Code: Select all
$var = array('name' => '', 'age' => '');Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
i have a logic where i am only interested in the indexes of the array, someone told me
$validfields['name'];
$validfields['age'];
but if i knew it was not correct, if i do print_r($validfields), it does not print anything , but on the other one
$validfields['name']="';
$validfields['age']="';
it prints.
$validfields['name'];
$validfields['age'];
but if i knew it was not correct, if i do print_r($validfields), it does not print anything , but on the other one
$validfields['name']="';
$validfields['age']="';
it prints.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Agreed. I'm not sure conceptually what the difference between the following if you are not going to use the value in the associative one:
Code: Select all
array('name' => '', 'age' => '');
// and
array('name', 'age');(#10850)