php - modifying variable in an array and then reinserting it -


hi want take value array, modify , insert new variable in array. kind of imagine looking follows have never worked arrays have no idea.

<?php     $foobar = array(         "foo" => "foo1",         "bar" => "bar1",     )   $new_variable = "<img src="$foobar["foo"])">";   $foobar[foo_img] = $new_variable;  print_r $foobar; ?> 

hope makes sense , thankyou in advance.

there syntax errors in code.

try this

$foobar = array(         "foo" => "foo1",         "bar" => "bar1" );  $new_variable = "<img src='".$foobar['foo']."'>";  $foobar['foo_img'] = $new_variable; print_r($foobar); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -