Array () elements?.

  • Hello,


    I've been learning HTML, CSS and PHP for about a month. So I am a newbie in these fields and have to ask, thanks in advance.


    Question: How can I determine an element from an array, so that I can save the element eg in a variable in order to access the array contents later in the code with the help of the variables.


    code

    1. $ navi_array = array ();
    2. $ navi_array ['home'] = "home.txt";
    3. $ navi_array ['help'] = "help.txt";

    Now I want the variable $ navi_var to store the element 'home' as string:


    code

    1. $ navi_var = "home";

    so that I can later access the array using the variable:


    code

    1. $ var_two = $ navi_array [$ navi_var]



    thanks

    iosman

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!