I made this array for an assignment, but I can't quite get it right. What I need for it to do is recognize a string from my array and print off if "I'm learning it". I think I'm close, but I keep getting undefined offset.
$myArray = array ("C ", "Java", "C++ ", "Objective-C", "C#", "PHP","(Visual)
Basic", "Python", "JavaScript", "Perl", "Ruby",
"PL/SQL", "Delphi/Oject pascal","Visual Basic.Net",
"lisp", "Pascal", "Ada", "Transact-SQL", "Logo", "NXT-G");
for ($i = 0; $i<sizeof($myArray); $i++)
echo $myArray[$i];
if($myArray[$i] == "C") {
echo "I'm learning this too!";
}
else {
echo "Your not learning anything";
}
forloop is mandatory, you can do the same using thein_arrayfunction without an explicit loop.