Concantenation with + = returns 0 [closed]

0

When doing this cycle, it prints 0. Why is this?

$ano = '<select>';
  for($i=date("Y"); $i>=1900; $i--){
     $ano += '<option value="'.$i.'">'.$i.'</option>';
  }
$ano +='</select>';
echo $ano;
    
asked by MarisabelGC 03.07.2017 в 21:26
source

1 answer

3

As you have been told, he is used. (point) to concatenate, in fact you do it with $ i.

Only change the + by. (point)

This:

$ano += '<option value="'.$i.'">'.$i.'</option>';

By:

$ano .= '<option value="'.$i.'">'.$i.'</option>';

This:

$ano +='</select>';

By:

$ano .='</select>';
    
answered by 03.07.2017 / 21:40
source