title: Best Way convert PHP5.4 Array Dereferences To Be PHP5.3 Compatible
body: <p><strong>Issue</strong></p>
  
  <p>Need to convert an Array Deference that works in PHP 5.4 to a version that works with PHP 5.3. I'm unable to update my live site PHP so I'm a bit stuck. What I'm trying to accomplish is create a coupon code for Drupal 7 as a form is submitted.</p>
  
  <p><strong>Where I've looked:</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/742764/php-syntax-for-dereferencing-function-result">PHP syntax for dereferencing function result</a> Good discussion. Almost looks like it isn't possible at all. There are several good solution examples that I haven't been able to convert to my issue. </p>
  
  <p><a href="https://stackoverflow.com/questions/14711654/5-4-dereferencing-to-valid-5-3-array-call">5.4 dereferencing to valid 5.3 array call</a> Very similar to my issue but I haven't been able to figure out a way using it.</p>
  
  <p><strong>Original that works in PHP 5.4:</strong></p>
  
  <pre><code>$coupon-&gt;store_discount_reference = ['und'=&gt;[['target_id'=&gt;"57"]]];
  $coupon-&gt;store_coupon_exclusive = ['und'=&gt;[['value'=&gt;"0"]]];
  $coupon-&gt;store_coupon_conditions = ['und' =&gt; [
      [
          'condition_name'=&gt;'store_coupon_usage_evaluate_usage',
          'condition_settings'=&gt; ['max_usage'=&gt;'1'],
          'conditions_negative'=&gt;0,
          'remove_condition'=&gt;'Remove'
      ],
  ]];
  </code></pre>
  
  <p><strong>What I Have Tried</strong></p>
  
  <pre><code>$coupon-&gt;store_discount_reference = array('und'=&gt; array('target_id'=&gt;"57"));
  $coupon-&gt;store_coupon_exclusive = array('und'=&gt; array('value'=&gt;"0"));
  $coupon-&gt;store_coupon_conditions = array('und' =&gt; array('condition_name'=&gt;'store_coupon_usage_evaluate_usage','condition_settings'=&gt; array('max_usage'=&gt;'1'),'conditions_negative'=&gt;0,'remove_condition'=&gt;'Remove'));
  </code></pre>
  
  <p><strong>Full Chunk</strong></p>
  
  <pre><code>$coupon = new stdClass();
  $coupon-&gt;type = "discount_coupon";
  $coupon-&gt;coupon_id = '';
  $coupon-&gt;code = $code;
  $coupon-&gt;bulk = false;
  $coupon-&gt;created = '';
  $coupon-&gt;status = 1;
  $coupon-&gt;uid = 0;
  $coupon-&gt;is_new = true;
  $coupon-&gt;commerce_discount_reference = ['und'=&gt;[['target_id'=&gt;"57"]]];
  $coupon-&gt;commerce_coupon_exclusive = ['und'=&gt;[['value'=&gt;"0"]]];
  $coupon-&gt;commerce_coupon_conditions = ['und' =&gt; [
      [
          'condition_name'=&gt;'commerce_coupon_usage_evaluate_usage',
          'condition_settings'=&gt; ['max_usage'=&gt;'1'],
          'conditions_negative'=&gt;0,
          'remove_condition'=&gt;'Remove'
      ],
  ]];
  commerce_coupon_save($coupon);
  </code></pre>