SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Man... u are a god!!!! If i could come and hug u i would!!! U are forever in my debt.. was getting there (but struggling)
    that middle statement is saying.."

    foreach ($rooms as $room => $capacity) {
    ****foreach($times as $time) {
    ********for($i=0; $i<$capacity; $i++) {
    ************PRINTTICKET($room, $time, $i+1);

    can't work out what this bit is doing *:
    for($i=0; $i<$capacity; $i++) {

    SOrry!! I bet ur getting narked off with me..

    I am getting there (or u are!)

    Cheers gav

  2. #27
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Man... u are a god!!!! If i could come and hug u i would!!! U are forever in my debt.. was getting there (but struggling)
    that middle statement is saying.."

    foreach ($rooms as $room => $capacity) {
    ****foreach($times as $time) {
    ********for($i=0; $i<$capacity; $i++) {
    ************PRINTTICKET($room, $time, $i+1);

    can't work out what this bit is doing *:
    for($i=0; $i<$capacity; $i++) {

    SOrry!! I bet ur getting narked off with me..

    I am getting there (or u are!)

    Cheers gav

  3. #28
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    read up on PHP's control structures:
    http://us3.php.net/for
    http://us3.php.net/foreach
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  4. #29
    Non-Member coo_t2's Avatar
    Join Date
    Feb 2003
    Location
    Dog Street
    Posts
    1,819
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I'm tellin

  5. #30
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    foreach ($rooms as $room => $capacity) {
    ****foreach($times as $time) {
    ********for($i=0; $i<$capacity; $i++) {
    ************PRINTTICKET($room, $time, $i+1);
    * foreach (runs thru the loop body for each value in array]
    So for $i is = to 0 if i is less than $capacity then si+1 (add one)

    print ticket

  6. #31
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Just wanna thank you sweatje

    have learnt loads in these few hours.. I will be honest with the guy and say I'm new to php etc..

    Gav

  7. #32
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you can explain that code, you have picked up a reasonable amount of PHP.

    It demonstrates two different uses of the PHP array construct, once as a hash map, and again as a vector. The code also show two different looping constructs, for and foreach. The $i is a simple integer index in the for construct.

    Understanding that, and explaining it in an interview, would demonstrate reasonable familarity with PHP as a programming language. Not understanding the concepts and pricipals behind the code, but showing it in the interview, would turn me off if I were in the employers seat.

    Study up, and good luck tomorrow.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •