Results 1 to 8 of 8
-
08-05-2004, 11:26 PM #1Web Hosting Guru
- Join Date
- Jul 2002
- Posts
- 315
If I know a little bit of Java, does that make PHP
easier to learn? Can I learn at least the basics of PHP in 3 weeks with some Java knowledge?
-
08-05-2004, 11:31 PM #2Web Hosting Master
- Join Date
- Nov 2003
- Posts
- 691
I have heard that PHP is somewhat similar to Java. If you already have some knowledge of programmaing concepts, I think you could pick up basic PHP in 3 weeks. Granted, you won't have much experience with debugging it and such, you could learn the basic functions (strings, loops, etc).
-
08-05-2004, 11:37 PM #3Web Hosting Guru
- Join Date
- Jul 2002
- Posts
- 315
Are strings, loops, etc. in PHP similar to Java? In comparison, isn't PHP easier to learn than Java or no?
-
08-05-2004, 11:43 PM #4Web Hosting Master
- Join Date
- May 2001
- Location
- Montreal, Quebec
- Posts
- 589
The PHP syntax is very similar to Java and C. However, Java is 100$ object oriented while PHP can do OO and strutural. But overall, PHP is a very easy language to learn.
-
08-06-2004, 12:33 AM #5WHT Addict
- Join Date
- Sep 2003
- Posts
- 131
Java is a programming language and PHP is a scripting language. Java has a much higher learning curve than PHP. Anyone with any previous knowledge of logic, etc., could probably pickup PHP in a few days, it really isn't very tough.
PHP *does* have some OO functions built into it, but it's nowhere near complete and just kind of a bad patch. (Thinking of <=v4 here, haven’t read anything about 5 just yet.)
[edit]
If you're thinking of the offline capabilities of it, once again I'll go with the limited functions deal. (Shouldn't take you too long to learn if you can program Java.)
-
08-06-2004, 02:02 AM #6Web Hosting Master
- Join Date
- Nov 2003
- Posts
- 691
PHP5 added a lot for object oriented coding. I don't know how strings and loops work in Java, so I couldn't answer that question. Head over to http://php.net and check out the manual.
-
08-06-2004, 07:01 AM #7Newbie
- Join Date
- Jul 2004
- Posts
- 23
Well if you're looking for a quicklist:
- Loop Constructs are identical (including foreach)
- Selection is identical (if / else / switch etc)
- String Handling is similar:
Code://Java Init String mystring = "foo"; // Java Append mystring = mystring + "bar"; // PHP Init $mystring = "foo"; // PHP Append $mystring = $mystring . "bar";
Another thing to bear in mind is that PHP is "loosly" typed. For example:
Code:$myinteger = 1 + 3; echo ($myinteger); // will output 4; $mystring = "1" . "3"; echo ($mystring); // will output 13
Hope that helps.
- Kar
-
08-06-2004, 05:13 PM #8Junior Guru Wannabe
- Join Date
- Jul 2002
- Posts
- 53
Hi Kit,
I have a Java->PHP translator project. Perhaps you might want to try this out. It's at www.NewOOP.com
If you have any questions, please feel free to contact me.
BTW, if you're solid with any programming, you can probably start writing decent PHP code in 3 hours (just get a good IDE, so you can see what the built-in functions do; I recommend Zend's IDE).