lcfirst

The lcfirst() function returns a string, with the first character in lower case – only if the first character is alphabetic.

PHP

echo lcfirst("Java is OK.");
=> // java is OK.

Ruby

my_string = "Java is OK.";

puts my_string[0,1].downcase + my_string[1..-1];
=> # java is OK.
By | 2009-08-03T14:11:57+00:00 July 10th, 2009|Categories: PHP, Ruby|Tags: , , , , , |2 Comments

About the Author:

2 Comments

  1. christophe February 22, 2010 at 3:03 pm

    Not sure you want the semicolon at the end of the Ruby statement 🙂

  2. RubyLove February 22, 2010 at 3:52 pm

    Ruby has the ‘minimal code’ approach and makes the semi-colon optional.

    I think PHP developers are more comfortable ending with semi-colon – Im not sure if this is a good thing, or if forcing them to move to Ruby standards is better.

Comments are closed.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.