Need some php help. Super simple

Discussion in 'BlackHat Lounge' started by Oblivion13, Jan 27, 2015.

  1. Oblivion13

    Oblivion13 Regular Member

    Joined:
    Sep 7, 2011
    Messages:
    479
    Likes Received:
    256
    I know I am missing something super simple but I cannot get it.

    I am trying to get my arrays to echo out in a sentence but it isnt working.

    My php

    Code:
    <?php
    
    $citys_array = array( 
                        "Berlin" => "Germany",  
                        "London" => "England", 
                        "Chicago" => "USA", 
                        "Tokoyo" => "Japan", 
                        "Montreal" => "Canada", 
                        "Tehran" => "Iran",
                "Cairo" => "Egypt", 
                        ); 
    
    $continent = "North America";
    echo "The Cities of $citys_array ['USA'] and $citys_array ['Canada'] are in $continent.";
    
    
    ?>
    
    
    What I am after is this result.
    Code:
    The Cities of Montreal and Chicago are in North America
    This is what I am getting now
    Code:
    [/FONT][/COLOR]The Cities of Array ['USA'] and Array ['Canada'] are in North America.[COLOR=#000000][FONT=Times]


    Any help would be appreciated.
     
    Last edited: Jan 27, 2015
  2. zagard

    zagard Jr. VIP Jr. VIP

    Joined:
    Oct 26, 2014
    Messages:
    208
    Likes Received:
    182
    Occupation:
    popoom pompomer
    Location:
    poompoom land
    Code:
    $citys_array = array(                    
                        "Germany" => "Berlin",  
                        "England" => "London", 
                        "USA" => "Chicago", 
                        "Japan" => "Tokyo", 
                        "Canada" => "Montreal", 
                        "Iran" => "Tehran",
                        "Egypt" => "Cairo", 
                        ); 
    
    
    $continent = "North America";
    
    
    echo "The Cities of " . $citys_array['USA'] . " and " . $citys_array['Canada'] . " are in " . $continent . ".";
     
    • Thanks Thanks x 1
  3. Oblivion13

    Oblivion13 Regular Member

    Joined:
    Sep 7, 2011
    Messages:
    479
    Likes Received:
    256
    Worked perfect. Thank You