Jump to content


[Solved] Parse Error


2 replies to this topic

#1 Mr. Jay

    Young Padawan

  • Members
  • Pip
  • 81 posts

Posted 25 March 2007 - 08:49 PM

Parse Error: unexpected T_ELSE on line 19

<?php
function location($id) {
	if (is_numeric($id)) {
		if ($id >= 1 && $id <= 8) {
			$location = array(
				"1"	=>	"Bronx",
				"2"	=>	"Ghetto",
				"3"	=>	"Central Park",
				"4"	=>	"Manhattan",
				"5"	=>	"Coney Island",
				"6"	=>	"Brooklyn",
				"7"	=>	"Queens",
				"8"	=>	"Staten Island"
			);
		}
		else {
			$location[$id] = "Bronx";
		}
	else {
		$location[$id] = "Bronx";
	}
	return $location[$id];
}
echo location(3);
?>

Thanks, Jon

Edited by Jonpopnycorn, 25 March 2007 - 11:27 PM.


#2 bay

    Young Padawan

  • Members
  • Pip
  • 105 posts
  • Gender:Male
  • Location:Chicago, IL USA

Posted 25 March 2007 - 10:41 PM

<?php
function location($id) {
    if (is_numeric($id)) {
        if ($id >= 1 && $id <= 8) {
            $location = array(
                "1"    =>    "Bronx",
                "2"    =>    "Ghetto",
                "3"    =>    "Central Park",
                "4"    =>    "Manhattan",
                "5"    =>    "Coney Island",
                "6"    =>    "Brooklyn",
                "7"    =>    "Queens",
                "8"    =>    "Staten Island"
            );
        }
        else {
            $location[$id] = "Bronx";
        }
    }
    else {
        $location[$id] = "Bronx";
    }
    return $location[$id];
}
echo location(3);
?>


#3 Mr. Jay

    Young Padawan

  • Members
  • Pip
  • 81 posts

Posted 25 March 2007 - 11:26 PM

Thanks :o





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users