Web Design and Programming Pt 4 PHP Arrays

[ad_1]
Here I show you how to use arrays with PHP. Along the way I show you how to use a bunch of built in PHP array functions and the foreach loop. The code is here


Posted

in

by

Tags:

Comments

28 responses to “Web Design and Programming Pt 4 PHP Arrays”

  1. Saurabh Saneja Avatar

    Video created 7 years ago. still valid today… much better than paid courses!! Thanks a lot Derek 🙂

  2. Bob Michael Cabatbat Avatar

    is it possible to just call on the value of the $myinfo?
    usually i do is
    $example = array("ex1", "ex2",)
    echo $example[1];

    OUTPUT:
    ex2

    but since you put a value on the key, is it possible to just print the value in it?

  3. Justin Munce Avatar

    You should explain why we would use this and what the functions are pointing to first. It was difficult to follow the list of commands you provided without the foundation of potential use.

  4. sethulekshmi .k.s Avatar

    Also please explain the use of print_r method

  5. sethulekshmi .k.s Avatar

    Hi, You used array_merge method in the first part and array($myInfo,$moreInfo) in the second part.
    What is the difference between the two?

  6. alexander shekhtman Avatar

    at the end of the video why not do this:
    foreach($customers as $key => $value){
    echo $key . ' : ' . $value . "<br>";
    }

    that code is easier to understand and smaller and does the same thing, no?

  7. Filia Leonis Avatar

    Hey, I would love to see how to make a website with a database (for example to make a webshop or intranet for companies) and how to use CMS so people can edit their own text-content without changing my design.

  8. thina bala Avatar

    how to create admin page sir please any example video give me

  9. Derek Banas Avatar

    Thank you 🙂 I have weird allergies that make my voice go crazy. I'm glad you like it

  10. Richard Million Avatar

    you should make audio books your voice is just amazing,

  11. Derek Banas Avatar

    foreach makes it easy to iterate over arrays, or objects. If you have foreach (your_array as $value) your_array is the array you will be iterating through from start to finish. Each step of the way the current value stored in array is assigned to $value. Does that help?

  12. Jeff Lever Avatar

    Can you please explain the "as" statement in a bit more detail in the for each loop. Not sure why, but it's confusing me. I just want to know what the code is telling the computer to do when it runs foreach ( $customers as $keys). Thanks!

  13. Derek Banas Avatar

    I very much appreciate that you took the time to tell me that 🙂 I'm very happy that they are helping and you're very welcome!

  14. Derek Banas Avatar

    Dziękuję. Jestem szczęśliwy, że pomoże im 🙂

  15. Tomasz Zlosnik Avatar

    Because my english is not so brilliant as yours tutorials I'm gonna write a comment in my language:
    Niesamowite tutoriale- szybko , konkretnie i bardzo przejrzyście nawet jak jak na takiego laika w sprawach PHP jak ja.
    What in shortcut means AWESOME !!!

  16. Derek Banas Avatar

    I use double quotes out of habit because when using single quotes any variables inside aren't evaluated to their value. I heard a long time ago that it was quicker to use commas with echo, so that is why I do that. I know you can't use them with print.

    You'll pick up habits over time. I'm glad you liked the video 🙂

  17. powerhousephg Avatar

    I noticed that, when echoing, you use commas to concatenate. Any reason you don't use periods? Also noticed you use double quotes for pretty much everything. Any reason you don't opt for single quotes for non-parsed data? Excellent tutorial, as always. I heart your channel!

  18. Derek Banas Avatar

    I think it is Monaco

  19. Derek Lyons Avatar

    What font do you use in your coding program?

  20. Derek Banas Avatar

    @powerhousephg Yes you are correct. In tutorials I don't always make everything as efficient as possible. Most of the time I'm doing this stuff out of my head and make little errors like that

  21. powerhousephg Avatar

    As always, great tutorial. Your stuff is always clear and to-the-point, while remaining informative. Question: Any reason for your use of double quotes for values that don't require parsing? ex: the title tag. Aren't single quotes better for performance in that situation?

  22. Derek Banas Avatar

    @dreamtownuk I sent your answer in another post. i hope that helps

  23. darkandgreen Avatar

    @derekbanas Can you explain more please? Can they both not do the same thing? . and , are doing the same thing for me

  24. darkandgreen Avatar

    Thanks!

    Questions:
    in the array, we are using double quotes, array("Name" => "Mike) , in the $_POST['We use single'], So, why cant we use single quotes in arrays? or why cant we use double in $_POST, I'm very confused on when to use double or single

    Question 2

    You are sometimes using
    echo $Var1, " " , $var2;

    other times you are using
    echo $var1 . " " . $var2;
    they both do the same thing? as the results are identical
    When do we use each?

    Thanks 100 times

  25. Derek Banas Avatar

    @prabhjotNZ The . is the concatenation operator in PHP use it for putting 2 strings together. The comma can be used for multiple types

Leave a Reply

Your email address will not be published. Required fields are marked *