Currently browsing tag

PHP

php

Building PHP extensions with C++ the easy way

Here is an easy way to build a PHP extension with C++ and default PHP packages on a Ubuntu system. I use SWIG to wrap C++ code to the Zend API. When using loops and recursion intensively, porting a few functions to C++ can give you some extra power. First, …

PHP Framework Comparison

PHP Framework Comparison Reading about PHP frameworks, you’ll get a lot about Symfony and Zend Framework. It is true that these frameworks have a lot of features and do great marketing. But what about performance and scalability? There are 2 kinds of frameworks: those written in C as an extension …

How to implement a real life benchmark with PHP

How to implement a real life benchmark with PHP pre { background-color:#444; white-space:pre-wrap; font-size:80%; padding:0px 6px; } To determine the maximum capacity of a web page, Apache ab is often used in the first step. Fetching one URL very often is optimal for caching and gives a best case. To …

Using V8 Javascript engine as a PHP extension update write PHP session

Using V8 Javascript engine as a PHP extension (update: write PHP session) pre { background-color:#444; white-space:pre-wrap; font-size:85%; padding:0px 6px; } “We Are Borg PHP. We Will Assimilate You. Resistance Is Futile!” Just got to something described as: This extension embeds the V8 Javascript Engine into PHP. It is called v8js …

PHP Deployment with Dropbox

PHP Deployment with Dropbox pre { background-color:#444; white-space:pre-wrap; font-size:85%; padding:0px 6px; } Deploying files over sFTP or scp is boring and takes a lot of time. Using git with commit-hooks to initiate the deployment process is comfortable, but there is a solution that’s even faster: Deploy your server(s) with a …

php

For or Foreach? PHP vs. Javascript, C++, Java, HipHop

Lessons learned: Foreach is 4-5 times faster than For Nested Foreach is 4-5 times faster than nested For Foreach with key lookup is 2 times slower than Foreach without C++ is 5-10 times faster than PHP running For/Foreach on Arrays Javascript is 2-3 times slower than C++/Java running For on …

php

Things you should not do in PHP

Here is a list of things you should not do in PHP. Most of the stuff is pretty obvious, but over the years I’ve seen a lot of them. In most cases, these problems remain hidden until data grows above 10000 entries. So on a development system, things are always …

PHP memory consumption with Arrays and Objects update generators

PHP memory consumption with Arrays and Objects (update: generators) pre { background-color:#444; white-space:pre-wrap; font-size:90%; padding:0px 6px; } Lessons learned: objects need more memory than arrays (+ 2-10 percent) comparing 32bit to 64bit systems, memory consumption increases by 100-230 percent if array values are numeric, don’t save them as strings! saving …

PHP with MySQL How to connect to MySQL database using PHP

PHP with MySQL: How to connect to MySQL database using PHP? Connection to MySQL database using PHP is very simple and includes only few steps. First of all we establish a connection to database using username and password. Then we select the database that is already created using MySQL console …

Replace Smarty with PHP templates

Replace Smarty with PHP templates pre http://blog.mousavi.net/wp-content/uploads/2013/01/{ background-color:#444; white-space:pre-wrap; font-size:90%; padding:0px 6px; } In many performance guides, Smarty is considered to be removed to speed up things. But oftentimes it’s not Smarty causing performance problems, but rather big modifier chains not being cached. To point this out, we need to …

Different Data Types in PHP

Different Data Types in PHP PHP supports wide range of Data Types. It supports eight different primitive data types: four scalar types (boolean, integer, float, string), two command types: (array and object) and finally two special types (resource, NULL). All these data types are discussed below: Boolean: Boolean is data …

PHP Tutorial The Operational Trail

PHP Tutorial: The Operational Trail In this section, I discuss about the operation of server to process PHP code. When you request some file like http://yourdomain/test.php on a web browser, as shown in above figure, then following different operations are performed on server. First web browser will make a request …