Archive

Archive for the ‘PHP’ Category

Case Sensitivity in PHP function names

July 19, 2012 1 comment

People from non PHP background will be confused a bit about PHP function’s case insensitivity while calling them from the PHP code. You can call the function name in any case (note that the name should be same) it will not trigger any error like we have in other languages like C++, JavaScript, etc

<?php
function foo() {
	echo "in foo<br>";
}

foo();
fOo();
FOO();
foO();
?>

All the above function calls will invoke the function foo without any issues. But personally I’d prefer to use a function name that matches with the function definition in the code to avoid any confusions in the future.

Advertisements
Categories: PHP