0

how can I add this array

    $triggers = [

    SMS_INVOICE => [
        'id' => 1,
        'name'        => 'Invoice Overdue Notice',
        'info'         => 'Trigger when invoice overdue notice is sent to customer contacts.',
    ]

this function without editing the function

   public function add_trigger($trigger)
{
   $this->triggers[] = $trigger;
}

the result will be

    array (size=10)
  'invoice_overdue_notice' => 
    array (size=3)
      'merge_fields' => 
        array (size=12)
          'id' => string '1' (length=1)
      'label' => string 'Invoice Overdue Notice' (length=22)
      'info' => string 'Trigger when invoice overdue notice is sent to customer contacts.' (length=65)
  'invoice_payment_recorded' => 

without [0] in front of it

3
  • 1
    You can do array_merge, to avoid numerical indexes in this case. Commented Jan 7, 2020 at 13:24
  • The function you say you are not editing uses [] to add to an array. That will use the next nonused integer, which will initially be zero. So, if you don't want zero, you need to edit that function. Commented Jan 7, 2020 at 13:32
  • okay notted @Tyralcori , that function is used for other actions. i was instructed not to modify it Commented Jan 7, 2020 at 14:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.