10 Simple tips to optimize and run your php code faster

Discussion in 'PHP' started by shahzadhanif, Dec 11, 2008.

  1. #1
    shahzadhanif, Dec 11, 2008 IP
  2. ignas2526

    ignas2526 Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is this multi server? because one function works faster on linux, second faster on windows. One function works faster witch small variable but slow witch large, second works faster witch large variable... and same.
     
    ignas2526, Dec 12, 2008 IP
  3. lp1051

    lp1051 Well-Known Member

    Messages:
    163
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Nice, I just think point 8 is not good to remember (if(isset($var{4})), as they are going to deprecate this curly method in PHP6, use $var[4] instead
     
    lp1051, Dec 12, 2008 IP
  4. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Thanks. Its nice and it taught me something =D
     
    ads2help, Dec 12, 2008 IP
  5. duperhost

    duperhost Well-Known Member

    Messages:
    817
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Thanks for such information.
     
    duperhost, Dec 12, 2008 IP
  6. shahzadhanif

    shahzadhanif Peon

    Messages:
    143
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks all for feedback.

    It's better if you comment on blog. I'll answer your questions there.
     
    shahzadhanif, Dec 12, 2008 IP
  7. flatroxs

    flatroxs Banned

    Messages:
    396
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks for sharing php programming tips, its helpful, thanks
     
    flatroxs, Dec 12, 2008 IP
  8. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #8
    Hmm, I didn't know that. But require_once not always avoidable if you have complex structure in your script.
     
    Kaizoku, Dec 13, 2008 IP
  9. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #9
    1- Better way. You should instead just use single quotes if there are no variables within the string. Double quotes checks and parses variables within it.

    8- Why would you even use strlen as a replacement to isset anyway?

    10- Laziness kicks in here, at the cost of resources, lol. :p
     
    chopsticks, Dec 13, 2008 IP
  10. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #10
    Thats why you should have properly planned code in your scripts. This will make sure that you won't need to use any _once functions as all files included will be included once, and only once.
     
    chopsticks, Dec 13, 2008 IP
  11. emilywilson

    emilywilson Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks for sharing these tips.
     
    emilywilson, Dec 13, 2008 IP
  12. xxKillswitch

    xxKillswitch Peon

    Messages:
    331
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #12
    How many blogs are going to repost the same optimization tips? Could have atleast re-written them instead of just adding in the fancy syntax hilighter...

    Just google PHP optimization tips, you will find atleast 40 results with the same copy and pasted tips...
    BOO!
     
    xxKillswitch, Dec 13, 2008 IP
  13. SeanBlue

    SeanBlue Peon

    Messages:
    110
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Interesting tips and a really nice site. I'm taken aback by how similar it is in some respects to my own. You seem to be working in the same areas. Check me out (signature) and let me know if you're interested in exchanging links.
     
    SeanBlue, Dec 14, 2008 IP