Recent Posts
thephpcode
Return To Blog Listing
thephpcode php code resource for all where we have code examples, cool techniques, tricks and sales of codes.
Recent Posts Tagged With 'loop'
Pre vs Post Increment in PHP
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!
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
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
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...
