Added: 4 years ago
From: thenewboston
Views: 49,313
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (41)

Sign In or Sign Up now to post a comment!
  • I'd say its only about 98 percent easier, but you were on the right track.

  • @pivotofpower 100x easier he said, not 100%.

    learn2math

  • Utube don't let me post open tags

  • I forgot -br /-

  • let me foreach myself.................

  • wow this is useful for making calendar

  • for each elements of $test is treated as $x (one at a time starting from the 1st) and echoed.

  • I love the foreach loop :p

  • thank you very much for this useful tutorial

    Waled

  • like the enhanced for loop in java ! thanks bucky

  • Thank you so much...

  • Usefull for making websites :)

  • Genius. - BehindVFX

  • Genius. - BehindVFX

  • I would think it's pretty confusing to the viewer that you keep switching from using single ' marks from quotation " marks. I don't know PHP very well, but I'm assuming they are some-what interchangeable. The viewer may not though.

  • nice

  • What is the reason you get arrayarrayarray when you do: echo $test;?

  • I like Array_values as it offers a more complex and detailed view of the array but for a simple view the foreach and for loops you showed work.

  • I don't understand the significance of $x in PHP as when I change my variable letter to anything other than x it won't display so i figure $x is something special in PHP?

  • I was thinking the same thing.

  • I agree. If you are going to teach, you need to teach proper syntax. It's the equivalent to a biology teacher leaving out connective tissue, an english teacher leaving out periods and a math teacher leaving out parentheses that are necessary to solve a problem in the correct order. It would also be useful to explain why a foreach statement is useful in a real world application, because your example doesn't give the foreach statement the merit it deserves.

  • well that was abit of a mysterious tutorial as the webpage readout for your code was three. so $x was just the last element of the array, i didnt understand why! thanks no worries i will find out with 5 mins of reading!

  • Can somebody tell me for what usefull think I can use that "foreach" because I don't find sence in it

  • Imagine you have a database where there are a LOT more values (hundreds or thousands) it's far less complicated to type than the for statement.

  • Yeah, very nice work there.

    All ready learned alot. And will continue watching your video's. And hopefully you will keep up the good work? :)

  • Thank s for this, I'm going to watch all of your tutorials now, learning a lot!

  • Well tats a new thing here =D thanks a lot buddy

  • Coming from c++ and c# the lack of type safety in php seems quite strange, but then again, I guess that there's a fair degree of freedom that goes along with that.

    Remember the curly braces for the above tutorial by the way.

  • thanks

  • how do i spit out the first two values only ?? please please help.

  • you need to use while make the number of array as a

    "$index" or some thing and telling the while to echothe arrays until the "$index" or what ever you chose to call it well be bigger then 2.

    hope i helped you to understend what to do =]...

  • wowowie wow!!!

    thanks again!

  • or array_values()

  • thank you so much!

  • thanks

  • I have watched a few tutorials to brush up on my PHP, and think they are clear and well presented. Thanks.

    One thing though on this tutorial, you have this:

    foreach ($test as $x) echo $x;

    maybe it's woth pointing out that when doing normal programming it is essential to have the curly braces, to tell the PHP interperater when the loop starts and ends:

    foreach ($test as $x) { echo $x; {

    Hope this helps someone. ;-)

  • the last curly bracket is backwards :P

  • Great video!

  • Brilliant

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more