0

I have an array:

 Array
(
 [0] => Array
 (
 [id] => 11
 [email_theme_id] => 1_5
 [email_template] => Array()
 [add_template] => 
 [email_template_subject] => Your free and bargain ebook alert for Sunday
 [last_update] => 1392314609
 )
 [1] => Array
 (
 [id] => 10
 [email_theme_id] => 2_12
 [email_template] => Array()
 [add_template] => 
 [email_template_subject] => Your free and bargain ebook alert for Sunday
 [last_update] => 1392314609
 )
)

and I need to change Array item [1] [email_template] value, so how should I do It with PHP?

asked Feb 14, 2014 at 12:51
2
  • 2
    You already answered your question u can use item [1] [email_template] = "new data" Commented Feb 14, 2014 at 12:52
  • this is what hard work everyday do with our brain... thanks :D Commented Feb 14, 2014 at 12:59

2 Answers 2

1

Just try with:

$data[1]['email_template'] = 'new value';

Where $data is your data variable.

answered Feb 14, 2014 at 12:52
Sign up to request clarification or add additional context in comments.

Comments

0

Try like

$item[1][email_template] = array('new value');

Or even you can do like

$item[1][email_template][0] = 'new value';

Considering that you want to update the array

answered Feb 14, 2014 at 12:53

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.