Archive for the ‘php’ Tag

Cannot redeclare geoip_country_code_by_name

Today I had this error on my Ubuntu Linux box

Fatal error: Cannot redeclare geoip_country_code_by_name()

The reason was that I have geoip extension enabled in my PHP configuration and also I used the geoip.inc file from maxmind.com.

The solution is very simple.

http://www.razvantudorica.net/03/cannot-redeclare-geoip_country_code_by_name/

Advertisements

A simple MVC framework

I will describe in the following post a (very) simple MVC framework. You can download the source code from here or can make a copy from bitbucket repository.

As you can see, we have the following folders:

web: here resides your public files (images, css, and index.php)
app: here you can find application files: models, views, controllers (MVC)

Continue reading

Public, Private, and Protected in PHP

or how to manage access to your classes.

In PHP there are three levels of access for properties and methods from within a class: public, private, and protected.

Public access is the default setting for method and for properties.

  • Public properties and methods can be accessed from any context.
  • Private methods and properties can ONLY be accessed from within the enclosing class. The subclasses have no access to them.
  • Protected methods and properties can be accessed from within the enclosing class and from subclasses.

According with Zend Coding Standards, variables that are declared with the “private” or “protected” modifier, the first character of the variable name must be a single underscore.

eg: private $_myVar;