Arrays 7/7


Deleting Array Elements
Finally, you can remove elements usingunset:
<?php
  $array = array("red", "blue", "green");
  unset($array[2]);
?>
You can even delete the whole array:
<?php
  unset($array);
?>
Instructions
Go ahead and remove "Python" from the$languages array using unset().
Arrays 7/7
<html>
  <head>
    <title>Modifying Elements</title>
  </head>
  <body>
    <p>
      <?php
        $languages = array("HTML/CSS",
        "JavaScript", "PHP", "Python", "Ruby");
        unset($languages[3]);



        // Write your code above this line. Don't
        // worry about the code below just yet; we're
        // using it to print the new array out for you!

        foreach($languages as $lang) {
          print "<p>$lang</p>";
        }
      ?>
    </p>
  </body>
</html>

Comments

Popular posts from this blog

MEGA 暫存檔案刪除

IOS GCD多執行緒

利用CMD指令強制刪除