Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



the unset( $val ) line ensures that the $val variable is deleted after the loop has finished. This is generally a good idea, because when the loop finishes, $val still holds a reference to the last element (that is, "Dickens"). If you were to change $val later in your code, you would inadvertently alter the last element of the $authors array
If you want to change selection, open document below and click on "Move attachment"

php 6
;Kafka", "Tolkien", "Dickens" ); // Displays "Steinbeck Kafka Hardy Dickens"; foreach ( $authors as &$val ) { if ( $val == "Tolkien" ) $val = "Hardy"; echo $val . " "; } <span>unset( $val ); echo "<span>
"; // Displays "Array ( [0] => Steinbeck [1] => Kafka [2] => Hardy [3] => Dickens )" print_r ( $authors ); Notice ho


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.