Jump to content

Muck A. Round

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Muck A. Round

  1. Thanks 🙂 I'll put my suggestions there.
  2. It seems there are more examples later in this section where they have a "Try it yourself" but the code doesn't produce anything in the output. It would be clearer if they either modified the code to produce at least something, or explain that the code won't produce any output because xyz.
  3. Yes - that's the code copy/pasted from the "Try it yourself". So they could have explained nothing would happen (or even not bother making it a "Try it yourself" when trying it doesn't do anything except show you the code again?). Looking at subsequent examples, I see that more code is necessary. It's good to know what these layers of code do, but was a little confusing when you hit the button and nothing happens.
  4. When I "Try it yourself" on the first example, and hit RUN, nothing appears in the right box. Is this correct? If so, I'm not sure of the point. Below is the code for that example. <!DOCTYPE html> <html> <body> <?php class Fruit { // Properties public $name; public $color; // Methods function set_name($name) { $this->name = $name; } function get_name() { return $this->name; } } ?> </body> </html>
  5. Ah - thanks everyone. What I was missing was that an associative array is defined as KEY => VALUE. So when you say "value" you're not talking about the value (or amount?) of any given entry, but value as the entity that each key is associated with.
  6. I feel like I'm missing something on the example for Sort Array (Ascending Order), According to Value - asort(). I added a var_dump and also switched the variables to ABC, and don't see that any sorting is occurring. <!DOCTYPE html> <html> <body> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); asort($age); var_dump($age); echo "<br><br>"; foreach($age as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } echo "<br>"; $age = array("C"=>"35", "B"=>"37", "A"=>"43"); asort($age); var_dump($age); echo "<br>"; echo "<br>"; foreach($age as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } ?> </body> </html>
×
×
  • Create New...