Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like you've got a decent way to validate that someone cannot pass in something that doesn't exist in your product array. That said, your description/comments about it retrieving the information from the products array is not quite valid. After doing the checks, you'd need to have something like</p> <pre><code>$chosenProduct = $product[$productKey]; </code></pre> <p>in order to actually get the product information.</p> <p>One more point of order, in your $product array, it really should have all of your keys quoted like so:</p> <pre><code>$product = array( "placeholder" =&gt; array( "item_title" =&gt; "Placeholder Title", "item_image_url" =&gt; "placeholder.png", "item_price" =&gt; "0.00", "item_description" =&gt; "Placeholder Description", "item_quantity" =&gt; 1, "product_icons" =&gt; false ), "widget" =&gt; array( "item_title" =&gt; "Product Title", "item_image_url" =&gt; "widget.png", "item_price" =&gt; "15.00", "item_description" =&gt; "Product Description", "item_quantity" =&gt; 1, "item_category" =&gt; array( "small" =&gt; "Small", "medium" =&gt; "Medium", "large" =&gt; "Large", "Xlarge" =&gt; "XLarge" ), "product_icons" =&gt; true ) ); </code></pre> <p>Without quoting, PHP will make an assumption that you're using constants. It will try to look up the value of the constants and assuming you don't have any constants that match any of those names, will throw a notice and tell you it's assuming you meant to use a string. Quoting will make it perform better and will not conflict with any constants that may have been defined with any of those keys.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload