php - Using concatenating assignment operator for 2 variables same time -
can use.= operator append same argument 2 or more variables @ same time?
like (not working example)
$a = "hello"; $b = "hi"; $a , $b .= " world!"; // $a = "hello world!" , $b = "hi world!"
you can use:
$items = array('hello', 'hi'); foreach ($items &$item) $item .= ' world!'; var_dump($items); or:
$a = "hello"; $b = "hi"; foreach (array('a', 'b') $key) $$key .= ' world'; var_dump($a); var_dump($b);
Comments
Post a Comment