Posts Tagged ‘php’

CLI with Zend Framework

October 17th, 2011

Brad Rodriguez

I decided it was only natural to apply the Zend Framework and its MVC System to our CLI scripts as well.

When I first started working with the Interfaces team at Rubicon, we were primarily a front end oriented team. As such, we didn’t have too many scripts that needed to be run from the command line. The few we had weren’t well organized.

As the team and code base grew, we began accumulating more and more adjunct scripts that really didn’t have a clear home in our code base. Plus, new scripts required many of the libraries that we used in our front-end framework—and those needed to be bootstrapped in every file. Things were becoming unwieldy, so I decided to clean it all up.

(more…)

A Deeper Look Into PHP Variables

September 12th, 2011

Jonathan Tansavatdi

Ever wonder how PHP can have so many different data types for its variables? PHP is regarded as a loosely typed language, and variables can change their data type easily. In fact, PHP can have eight different types:

  • integer numbers (stored as longs in c)
  • floating point numbers (stored as doubles in c)
  • strings (stored as a char array in c)
  • Booleans (stored as 0 or 1 as longs in c)
  • Arrays (stored as HashTable struct in c)
  • Objects (stored as zend_object_value in c)
  • Resources (stored as zend_object_value in c) [references functions or external PHP resources]
  • Null (nothing is stored, only type is set to null type)

A deeper look into PHP’s inner workings reveals how this is possible.

 

(more…)