PHP tokens and opcodes : 3 useful extensions for understanding the working of Zend Engine

Posted 11 CommentsPosted in PHP
"PHP tokens and opcodes" - When a PHP script is executed it goes through a number of processes, before the final result is displayed. These processes are namely: Lexing, Parsing, Compiling and Executing. In this blog post, I will walk you through all these processes with a sample example. In the end I will list some useful PHP extensions, which can be used to analyze results of every intermediate process. Lets take a sample PHP script as an example: <?php function increment($a) { return $a+1; } $a = 3; $b = increment($a); echo $b; ?> Try running this script through...

PHP Extensions – How and Why?

Posted 39 CommentsPosted in PHP
In this short post we will quickly see: How to write PHP extensions? Why to write PHP extensions? However before you could understand what we are going to disucss, I will recommend you to read one of  my previous post How does PHP echo’s a “Hello World”? - Behind the scene . In this post I discussed in brief the backend architecture of PHP. Assuming you have read the previous post, lets discuss on how to build our first PHP extension: Every PHP extension is built out of minimum of 2 files. Configuration file (config.m4) which tells us what files...

How does PHP echo’s a “Hello World”? – Behind the scene

Posted 24 CommentsPosted in PHP
Have you ever wondered how PHP echo's a "Hello World" for you on the browser? Even I didn't until I read about the PHP internals and extensions. I thought may be a few out there will be interested in exploring the other side of PHP, so here we go. In my last post I discussed in brief "How your browser reaches to my server when you type http://abhinavsingh.com in address bar?". Read through if you have missed out on that. Here I will discuss in brief "How does PHP churns out the content requested on the webpage?" An Overview Here...