Skip to content

Asher Bond

I stay in SF, live in the Bay, represent cloud technology and the California way.

Archive

Tag: php

Facebook is written mostly in PHP, which generally scales well for most sites. Large scale web sites can greatly reduce memory resource utilization as well as CPU resource utilization by eliminating unused and inefficient code instructions.

Although PHP is considered to be a scripting language, PHP’s parser does in fact compile code before it is processed by the Zend Engine. Opcode caching allows compiled PHP code to be shared and recycled in memory, rather than compiling the PHP source on the fly. Opcode caching is already available in Zend Server’s community edition and will be available when PHP6 is released.

HipHop takes a much more aggressive approach to performance optimization by translating the source code into C++ which can be compiled into more machine specific instructions. Not only does HipHop compile the source code into a more system friendly language, it also rewrites your code to be more efficient. Through static binding, scripty system calls and functions such as eval() are eliminated and loosely defined types are tightened up to meet specific runtime requirements. Here is an illustration of how HipHop optimizes PHP:
How Facebook HipHop Optimizes PHP

According to Facebook’s Senior Engineer Haiping Zhao, HipHop reduced Facebook’s CPU overhead by 50%!

HipHop will be released tonight under the open PHP license.

If you have addthis.com and you aren’t satisfied with the plain share button that’s available for WordPress, you can use this code to change it to the fully functional dropdown share menu. Just add this code to the end of your blog posts. You will most likely want to add it to the archive.php, index.php, and single.php files in your theme directory ( /path/to/wordpress/site/wp-content/themes/sometheme/single.php etc.)

I just made one php file called addthis_button.php that had this code in it:

[source:php]<?php
// change this to your addthis user name
$addthis_user=’asherbond’;
?>

<!– AddThis Button BEGIN –>
<script type=”text/javascript”>addthis_pub = ‘<?php print $addthis_user; ?>’;</script>
<a href=”http://www.addthis.com/bookmark.php?pub=<?php print $addthis_user; ?>&url=”<?php print get_permalink(); ?>”&title=”<?php print get_the_title($id); ?>”\”" onmouseover=”return addthis_open(this, ”, ‘<?php print get_permalink(); ?>’, ‘<?php print get_the_title($id); ?>’)” onmouseout=”addthis_close()” onclick=”return addthis_sendto()”><img src=”http://s9.addthis.com/button1-share.gif” width=”125″ height=”16″ border=”0″ alt=”" /></a><script type=”text/javascript” src=”http://s7.addthis.com/js/152/addthis_widget.js”></script>
<!– AddThis Button END –>
[/source]

Then I added the code to include it in each of these files: single.php, index.php, and archive.php:

[source:php] <?php include(‘addthis_button.php’); ?>[/source]