php - Variable inside a string inside array? -



php - Variable inside a string inside array? -

in php, want create array of strings variables, this:

$myarr = array("this $animal.", "something else");

what happens if this:

$animal = "dog"; $myarr = array("this $animal.", "something else"); $animal = "cat"; echo $myarr[0];

will output "this dog." or "this cat."

in other words, variable within string within array change?

after string defined, no longer changes. variable expansion happens @ define-time.

i agree @esqew though have taken sec verify this.

php

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -