Ver código fonte

Do not iterate by reference

Iteration by reference is generally only used when the variable is
changed and that change should be reflected in the array. Whether
this is faster or not is irrelevant since this is a realistic
implementation.
Levi Morrison 10 anos atrás
pai
commit
276ddaaf86
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      frameworks/PHP/php/fortune.php

+ 1 - 1
frameworks/PHP/php/fortune.php

@@ -30,7 +30,7 @@ asort($arr);
 <th>message</th>
 </tr>
 <?php
-foreach ( $arr as $id => &$fortune ) {
+foreach ( $arr as $id => $fortune ) {
 ?>
 <tr>
 <td><?php echo htmlspecialchars($id, ENT_QUOTES, 'UTF-8'); ?></td>