2018-03-07 14:43
浏览 436


I'm using PHP 5.4 and trying to add dictionary-style complex values to an array thusly:

array_push($qbProductsArray, $qbProduct => $authNetAmount);

I get this error:

Parse error: syntax error, unexpected '=>'

My desired result is to have a series of $qbProduct and $authNetAmount that are related together. I don't want to add them separately like this:

array_push($qbProductsArray, $qbProduct, $authNetAmount);

...because those 2 values are related to each other, and I don't want them just all thrown in together, even though they are adjacent. I want a firmer link between them. How can this be done?

图片转代码服务由CSDN问答提供 功能建议

我正在使用PHP 5.4并尝试将字典式复杂值添加到数组中:</ p>

  array_push($ qbProductsArray,$ qbProduct =&gt; $ authNetAmount); 
 </ code> </ pre> 

我收到此错误:</ p>

解析错误:语法错误,意外'=&gt;'</ p> </ blockquote>

我想要的结果是有一系列的 与代码相关的 $ qbProduct </ code>和 $ authNetAmount </ code>。 我不想像这样单独添加它们:</ p>

  array_push($ qbProductsArray,$ qbProduct,$ authNetAmount); 
 </ code> </ pre> 

...因为这两个值彼此相关,我不希望它们全部被抛在一起,即使它们是相邻的。 我希望他们之间有更紧密的联系。 怎么办呢?</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题