SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Executing time

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    PHP World
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Executing time

    Hello ..

    for example , this code :

    PHP Code:
    <?

    $turn 
    1;

    if (
    $turn == 1) {
     for (
    $i=0;$i<=10000;$i++) {
      echo 
    $i " test"
     }
    echo 
    "Hello";
    }

    ?>
    for example , when i executing this code and $turn = 1 will get 2 sec (example only) .

    ok , when $turn = 0 will php interpreted disregarding this code :

    PHP Code:
     for ($i=0;$i<=10000;$i++) {
      echo 
    $i " test"
     } 
    and will load reduce 2 sec to 0.5 sec ?

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    San Diego, CA (USA)
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why dont you do this:

    PHP Code:
    $turn 1;

    if (
    $turn == 1) {
         
    sleep(2); //pause the script for 2 seconds
         
    print 'Hello';


  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    PHP World
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello ..

    no this example i want to check if i can optimization , becuse i have script , and i want give user to options , if he choose option 1 the loop code (in example) will switch , else the one line will switch and disable loop code .

    sorry for my bad English


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
  •