Recent Posts

thephpcode

thephpcode

Return To Blog Listing

thephpcode php code resource for all where we have code examples, cool techniques, tricks and sales of codes.

Search This Blog's Tags For:

Recent Posts Tagged With 'loop'

  • Pre vs Post Increment in PHP

    Posted on Saturday October 10th, 2009 at 04:14 in php, code, optimize, loop, iteration

    Earlier on I was browsing Google Code, and I chanced upon JSpeed - a javascript optimizer. I saw that they actually change post increments to pre-increments. I wondered why and thought I could ask this on Stack Overflow.One theory came up to be "prei...

  • Optimize your code: Keep functions out of statements!

    Posted on Sunday August 23rd, 2009 at 19:22 in speed, functions, statement, optimize, while, loop

    It's always said that we should think out of the box. In any programming language, we should write functions out of certain statements statements.Consider this:<?php$arr = array(/* 10000 elements */);for($i = 0; $i < count($arr); $i++){ // ...}?&g...

  • PHP Code crashes Apache

    Posted on Sunday July 19th, 2009 at 08:43 in test, crash, load, while, loop, xampp, apache friends

    Today i was reading up DoS and DDoS on Wikipedia when i came across this thing about Forkbomb (a kind of wabbit). So I tried it out on my own localhost server. This was what i wrote in the file:<?phpwhile(include(basename($_SERVER['PHP_SELF'])));?...

  • Arrays Loop Benchmarking: foreach vs while

    Posted on Saturday July 4th, 2009 at 23:48 in tips, speed, test, while, benchmark, loop, foreach

    Yes yes, i am current obsessed with loads of PHP speed tests on my local machine. But today I worked on something interesting: foreach vs while loops for Arrays.Remember one of my posts titled "PHP Loop Benchmarking - WHILE vs FOR"? It talks about yo...