PHP Array with double values
I'm beginning with PHP and I would like to get your help in order to populate array with double value.
I have this little script :
$liststatus=array(
'-1'=>$langs->trans("Draft"),
'1'=>$langs->trans("Validated"),
'0'=>$langs->trans("Resiliated")
);
I would like to add'10'=>$langs->trans("Validated")
. In this way, validated search button should displays$liststatus
with both values'1'
and'10'
I tried :
$liststatus=array(
'-1'=>$langs->trans("Draft"),
'1'=>$langs->trans("Validated"),
'10'=>$langs->trans("Validated"),
'0'=>$langs->trans("Resiliated")
);
But it displays twice validated button.
So How I can write something like this :
'1' && '10'=>$langs->trans("Validated")
I tried this syntax but it doesn't work.
Thank you :)
Answer
Solution:
Array or hash need to have Key and Value.
What you did here is correct as both ket '1' and '10' pointing to value 'Validated'.
Or if you really hate see 'Validated' repeated there, you can split it into two arrays.