Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think Joomla and Wordpress are not the greatest examples of <em>good</em> PHP code, with no offense. I have nothing personal against the people working on it and it's great how they enable people to have a website/blog and I know that a lot of people spend all their free time on either of those projects but the code quality is rather poor (with no offense).</p> <p>Review security announcements over the past year if you don't believe me; also assuming you are looking for performance from either of the two, their code does not excel there either. So it's by no means good code, but Wordpress and Joomla both excel on the frontend - pretty easy to use, people get a website and can do <em>stuff</em>.</p> <p>And that's why they are so successful, people don't select them based on code quality but on what they enabled them to do.</p> <p>To answer your performance question, yes, it's true that all the good stuff (functions, classes, etc.) slow your application down. So I guess if your application/script is all in one file, so be it. Feel free to write <em>bad PHP code</em> then.</p> <p>As soon as you expand and start to duplicate code, you should consider the trade off (in speed) which writing maintainable code brings along. :-)</p> <p>IMHO this trade off is rather small because of two things:</p> <ol> <li>CPU <strong>is</strong> cheap.</li> <li>Developers <strong>are not</strong> cheap.</li> </ol> <p>When you need to go back into your code in six months from now, think if those nano seconds saved running it, still add up when you need to fix a nasty bug (three or four times, because of duplicated code).</p> <p>You can do all sorts of things to make PHP run faster. Generally people recommend a cache, such as <a href="http://php.net/apc" rel="noreferrer">APC</a>. APC is really awesome. It runs all sorts of optimizations in the background for you, e.g. caching the bytecode of a PHP file and also provides you with functions in userland to save data.</p> <p>So for example if you parse a configuration file each time you run that script disk i/o is really critical. With a simple <a href="http://php.net/apc_store" rel="noreferrer">apc_store()</a> and <a href="http://php.net/apc_fetch" rel="noreferrer">apc_fetch()</a> you can store the parsed configuration file either in a file-based or a memory-based (RAM) cache and retrieve it from there until the cache expired or is deleted.</p> <p>APC is not the only cache, of course. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload