Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2002
    Posts
    314

    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?

  2. #2
    Join Date
    Nov 2003
    Posts
    682
    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).

  3. #3
    Join Date
    Jul 2002
    Posts
    314
    Are strings, loops, etc. in PHP similar to Java? In comparison, isn't PHP easier to learn than Java or no?

  4. #4
    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.

  5. #5
    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.)

  6. #6
    Join Date
    Nov 2003
    Posts
    682
    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.

  7. #7
    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";
    The main differences come with the Object Oriented side of things. You're constantly reminded of the fact you're programming in a OO language with Java. In PHP you have to be really careful how you structure your code, but it is very possible to get a OO feel to it (in particularly with PHP5).

    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
    So you don't need to use a datatype when initialising a variable in PHP.

    Hope that helps.

    - Kar

  8. #8
    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).

  9. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Related Posts from theWHIR.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •