Tag: php


String.Capitalize in C# (PHP’s ucwords in C#)

I have been playing around with C# recently and found the need for functionality similar to that provided by PHP’s ucwords() function. I dont think this exists in C# as standard so here is a simple extension method to achieve ucwords in C# using a little bit of LINQ (the extremely useful Aggregate extension method) to achieve it:

public static string Capitalize(this String s)
  return s.ToCharArray().Aggregate(String.Empty,
    (working, next) =>
      working.Length == 0 && next != ' ' ? next.ToString().ToUpper() : (
        working.EndsWith(" ") ? working + next.ToString().ToUpper() :
          working + next.ToString()

With this included in your name space, the extension method can be used on any String instance like:

string myString = "this sentence needs capitalization!";
//This Sentence Needs Capitalization!

Short but sweet!


Install phpUnderControl on CentOS 5

A while back now I started setting up a server to use as a development machine. From a standard CentOS 5 installation I have installed SubVersion and Trac. Now I have finally got round to installing phpUnderControl for continuous integration and build management.

As usual, there are many great guides already on the net but getting everything to work usually requires a few of these references and a few additional changes. I will point out where I got the information from where applicable but the aim of this guide is to be complete and comprehensive.

If you follow this guide you should start with a basic CentOS 5 installation with Subversion setup correctly and end up with a working installation of phpUnderControl.

Continue Reading..


Zend Certified Engineer!

I finally got round to booking the Zend PHP 5 Exam and successfully passed earlier this week!

I didn’t think that the exam was particularly hard but whilst revising I did learn about a few interesting features of the language.

I would recommend becoming a Zend Engineer to anyone who is serious about PHP software development. If anyone is interested I have a few online practice exams going spare.

For more information on Zend certification, see this article

Zend Certified Engineer


Zend Framework 1.0.3 Released

Zend Framework (ZF) 1.0.3 has been released. This is the third maintenance release since the launch of Zend Framework 1.0 at the beginning of July 2007, which goes to show how quickly the ZF community is growing.

Zend Framework is quickly becoming the most popular PHP5 framework, mostly due to the fact that it does not tie you to coding in a specific way. You can use individual components or choose to use the entire Model-View-Controller (MVC) architecture. In a post written on the Zend Blog, the ZF team are expecting over 3 million downloads of the framework by the end of the year.

The near future roadmap for ZF includes adding support for even more web services and providing a standard solution for handling web forms. There will also be improvements in the online documentation (which is already an excellent reference) and tutorials as well as support for OpenID.

We can expect some of these features to be ready for the upcoming 1.1.0 release which is expected in the first quarter of 2008.

For more information, see Zend Framework Components and the Zend Framework roadmap.

Download Zend Framework.