PHP-Control Flow: Switch-6.All On Your Own


Hello Friends, I am again stuck on control flow, Please point my mistake or offer suggestion.Thanks in advance.

    $city = moniker;
    switch ($city){
        case "New York":
            echo "Big Apple";
        case "Paris":
            echo "City of Lights";
        case "Rome":
            echo "Eternal City";
            echo "Your Couch!";


I get this message in output window:

Use of undefined constant moniker - assumed 'moniker' (line 8)Your Couch!


what is moniker?

isn't a string value?
so enclose it in single or double quotes


type $moniker and will run fine :slight_smile:


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