Java and PHP

This article is an ongoing list of the similarities and differences between Java and PHP.
If you learn any programming language, you're at a benefit over a complete newbie, because all languages are similar.
If you know PHP, especially now that's it's object-oriented, you'll have little to no problems learning Java.
Most programming languages are very similar. In fact, most of them are derived from the same language.
PHP and Java are similar because they're both derived from the same language, which is C. Thus, if you know one, it's pretty easy to learn the other.
Below proves how similar they are.
This is an ongoing list, so more functions are going to added regularly.
Function | Java Function | Java Example | PHP Function | PHP Example |
Break up a string based on a parameter in the string | split() | string.split(", "); | explode() | explode("," , $string); |
Extracts a substring from a string | substring() | string.substring(3); | substr() | substr($string,3); |
Replaces something in a string | replaceAll() | string.replaceAll("m",
"n"); //replaces m with n |
str_replace() | str_replace("m", "n",
$string); //replaces m with n |
Finding the length of a string | length() | string.length(); | strlen() | strlen($string); |
Finding the position of something in a string | indexOf() | string.indexOf("m"); // finds position of m |
strpos() | strpos($string, "m"); |
Making a string lowercase | toLowerCase() | string.toLowerCase(); | strtolower() | strtolower($string); |
Making a string uppercase | toUpperCase() | string.toUpperCase(); | strtoupper() | strtoupper($string); |