Jamie Balfour BSc

Welcome to my personal website!

Technology enthusiast

I am very interested in technology, particularly relating to computer science. I am most interested in web design and development.

My main hobby is programming. One of my most well known products from this is ZPE. I also am the sole creator of BalfBlog, BalfBar and BalfSlider.

A little bit about me

In 1997, when I was six years of age, I got my very first computer. I was always very interested in the ins and outs of it and dismantled it to see how it worked.

Years later, in 2016 I received my BSc (with honours) in Computer Science, obtaining a First class degree.

I'd like to welcome you to my website and hope you enjoy using it as much as I have enjoyed building it!

Google Plus
Ghost
Me
Jamie Balfour BSc
Full stack developer

The inconsistencies of PHP

22 Apr 2015 at 18:34
Whilst PHP has been one of my all time favourite language for what it can do, it has a very bad level of inconsistency through out the syntax.

Perhaps I am somewhat of language snob, so forgive me if I come across that way in this article but I do believe that PHP is a hugely inconsistent language.

In this article I am going to explain my findings I have found when I have been working with this language. I am only criticising the syntax of PHP, not what it does because it is still by far one of my favourite programming languages.

Introduction

As I say, I am a bit of a language snob - I like languages that are easy to read, write and remember. A programming language with inconsistencies is not a language I consider to be any of those three properties. As such, I consider PHP to be one of those inconsistent languages.

By saying all of this, I do use PHP on a daily basis. My website is powered by a range of PHP-based functionalities. I also really love PHP for what it can do, and whilst I do very occasionally have to check out the amazing documentation provided in order to get the function name I am looking for, I still love it as a language.

Now I am not saying that PHP is the only language with horrible syntax. Let me name another - Java and don't even get me started on that. I despise Java because of things like creating an ArrayList become complicated:

Java
int i = 10;
ArrayList<Integer> arr = new ArrayList<Integer>()
		

So in one instance we are talking about int then we are talking about Integer. Just horrible!

A look at some of the problems

PHP has a random collection of inconsistencies that are everywhere. I quote Jeff Atwood (whose article came up first on a search here) here:

PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory.

I've been using PHP for over two years as my main programming language and have noticed a few really bad inconsistencies throughout the language including:

nl2br() - new line to break. Why the heck has this got a 2 rather than a to?

file_get_contents() - we have underscores.

fopen() - an old C style construct. So we now have two ways of opening a file, but one way only has an f for file and the other has the full word file.

filemtime() - stands for file modified time. Should that not be file_modified_time or, like the old C-style, fmtime?

htmlentities() - now I'd really like the underscores here!

strpos and str_replace - one has an underscore the other does not!

Parameter ordering

The order of parameters sometimes also gets messy:

For str_replace :

PHP
str_replace(search, replace, subject)
		

Basically for this it follows (ignoring the replace parameter) search -> subject.

Then we come to the strpos which obtains the first position of a character or string within a string:

PHP
strpos(subject, search)
		

Now it is subject -> search so the whole concept has flipped.

Conclusion

I in no way hate PHP. In fact, I do actually adore it, partly because it's such a powerful web development language which has a fantastic collection of documentation on it but also because it's easy enough to your head around the problems and inconsistencies of it.

But what do you think? Comment below:

Site accessibility

A lot of the original functionalities that once existed here have been removed.

This page was generated in 0.24 seconds using 2097152 bytes. Slow? Let me know.

To use project mode, the window must be greater than 920 pixels in width.
Click here to disable Project Mode.
This site uses cookies to deliver its services, to personalise ads, to store preferences and to analyse traffic. Information about your use of this site is shared with other companies. By using this site, you agree to its use of cookies.
Contact me
Contact Jamie Balfour

Get in touch with me via this form.