+ Reply to Thread
Results 1 to 4 of 4




  

Thread: PHP IF Statement Evaluation & Server Overhead

      
  1. #1
    The Force is Strong! undoIT is on a distinguished road undoIT's Avatar
    Join Date
    September 8, 2008
    Posts
    22
    Rep Power
    4
    Feedback Score
    0

    Default PHP IF Statement Evaluation & Server Overhead

    Does anyone know how much server overhead there is when PHP if statements are evaluated, i.e. memory consumption and CPU usage and if this is a major issue? I've searched around and didn't find anything that definitively answered this question.

    For example, if I have a WordPress blog and use a lot of if statements to render each post summary on the home page, is this going to require a great deal more server resources if the home page starts getting high traffic? And, on pages where many posts are listed (i.e. category pages) , it seems like this could become an issue.

    Or, is this something I shouldn't even be worrying about?
    Hostgator Coupon - The best deal on green web hosting
    Free HTML Templates - Themebot
    Internet Explorer 6 must die!

  2. #2
    Jedi Master Paramiliar is on a distinguished road Paramiliar's Avatar
    Join Date
    July 24, 2007
    Location
    West Midlands
    Posts
    105
    Rep Power
    5
    Feedback Score
    0

    Default Re: PHP IF Statement Evaluation & Server Overhead

    What exactly are you trying to do?

    If you just want to know how long it takes for an expression in an if statement to run well it depends on what your doing, for instance

    if ($i == $j) will run very quickly but

    if (md5($i * 12 / 400 * time()) == 'hj4lsj7ghn3128klj84kmnqdf90lee32 will take longer to evaluate.


    Generally if statements wont give your server any problems as its simple maths
    Last edited by Paramiliar; Aug 17th, 2009 at 3:46 am. Reason: update
    Matthew Bagley
    Paramiliar Design Studios
    IT Consultant | Website Design | Website Development

  3. #3
    The Force is Strong! undoIT is on a distinguished road undoIT's Avatar
    Join Date
    September 8, 2008
    Posts
    22
    Rep Power
    4
    Feedback Score
    0

    Default Re: PHP IF Statement Evaluation & Server Overhead

    For the most part, I am evaluating whether a value exists for a certain field in a database or whether a certain value exists for the current post.

  4. #4
    Jedi Master Paramiliar is on a distinguished road Paramiliar's Avatar
    Join Date
    July 24, 2007
    Location
    West Midlands
    Posts
    105
    Rep Power
    5
    Feedback Score
    0

    Default Re: PHP IF Statement Evaluation & Server Overhead

    well I tend to do an if strlen($var) > 0 as i've had issues with isset and empty in the past but really I wouldn't worry about the time it takes for an if statement to evaluate you'd be better stream lining queries
    Matthew Bagley
    Paramiliar Design Studios
    IT Consultant | Website Design | Website Development

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. new privacy statement today?
    By AnnREgirl in forum Adsense
    Replies: 1
    Last Post: Apr 7th, 2009, 10:25 am
  2. Strange Estibot evaluation
    By Purple Rain in forum Domain Names
    Replies: 8
    Last Post: Sep 28th, 2008, 9:29 am
  3. What do you think of this statement?
    By Purple Rain in forum Web Hosting
    Replies: 9
    Last Post: Sep 24th, 2008, 3:58 am
  4. Web Evaluation Website Script Limited
    By averyquest in forum Content
    Replies: 1
    Last Post: Sep 14th, 2008, 1:19 am

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
WebTalkForums
WebTalkForums
Recent Forum Threads