Deleting Array Elements. Please help!


#1

Can someone help me with the codes below? What's wrong? The Python is still there. It should be removed.

<?php
$languages = array("HTML/CSS",
"JavaScript", "PHP", "Python", "Ruby");
unset($array[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>";
    }
  ?>

The result is like this:

Undefined variable: array (line 10)

HTML/CSS

JavaScript

PHP

Python

Ruby


#2

You have a wrong code there that doesn't belong.

try to replace the code above with the code below:


#3

Already solved, it's because of unset($array[3]);

should be:
unset($languages[3]);

haha...anyway, thanks for the reply Funct1on.


#4

Well i have a diffrenet code for me so...yea! :grin:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.