Question:
java or php web language?
b-i-n-g-o
2009-01-22 00:03:56 UTC
java or php web language?
Six answers:
Andy D
2009-01-22 00:14:11 UTC
PHP is better for creating web pages that interact with databases, probably quicker to learn and get things running with



Java you'd use for applets embedded in web pages, which can be slower to load and look a bit old fashioned; usually more work than PHP but better for formal object oriented programming
K L U D G E
2009-01-22 05:28:58 UTC
the choice is yours, chose one you like cuz it matters,,



i'm just confused when other people said "php is used only for web devlopment"



i just can say to that people "welcome to earth"



PHP do:



Server-side scripting

=================

PHP was originally designed to create dynamic web content, and it is still best suited for that task. To generate HTML, you need the PHP parser and a web server to send the documents. PHP has also become popular for generating XML documents, graphics, Flash animations, PDF files, and more.





Command-line scripting

===================

PHP can run scripts from the command line, much like Perl, awk, or the Unix shell. you might use the command-line scripts for system administration tasks, such as backup and log parsing.





Client-side GUI applications

====================

Using PHP-GTK http://gtk.php.net, you can write full-blown, cross-platform GUI applications in PHP



see what Rasmus said http://www.oracle.com/technology/pub/articles/php_experts/rasmus_php.html



good luck with your choice
Tay K
2009-01-22 01:32:44 UTC
PHP is probably the best tool for the job. Java is overkill for anything except the most complex of web sites. PHP is installed on almost every web server, is relatively easy to get started with, has excellent integration with most database systems, and there are tons of features that are useful for web design.







That said, the PHP language sucks. Seriously, who decided to only use associative arrays instead of true lists? Maybe when I deleted that item I wanted to get the array indices shifted down! And what genius used completely inconsistent naming conventions for functions that act on the same data type? count, asort, array_walk, and key all act only on arrays. How about array_length, array_sort, array_walk, and array_key. Why not find the size of a variable using a function like size(value) that works on all data types? But no, each data type has to have its own set of functions that don't even have internal consistency, let alone consistency with the rest of the language.







Anyway...



Go for PHP, but be aware that it rots your brain unless you're using a decent language at the same time. To avoid brain rot and help anyone who must read your code in the future (including you) follow these pointers.



- Make things modular. That means writing functions for commonly used code, then putting them in a separate file and including that file. Use require_once to make sure you're not including files twice (hard to track down errors) and that your script will 100% die if it can't find the required file.

- Within the last few years PHP had decent object oriented programming support added on. Use where appropriate, but overkill isn't necessary (this isn't Java, after all).

- If your web host has PDO available then use it. If not, request it. PDO makes database queries easier, has an excellent interface, and is just generally easier to use. Plus if you need to change your database backend then you don't have to change around a bunch of function names.

- If there are any settings (database user names, passwords, etc.) then use a config file. I wrote a web app a few years ago for an annual competition. Out of habit I used a file named config.php. To this day the person I wrote it for just copies over the files, changes some things in config.php, creates a new database, and then he's ready to go!

- Often when you're writing a function/class in a separate file you will include the file, then want to redirect the user to another page. Make very sure that included library files don't have any whitespace before or after the PHP tags (). You will get strange errors if there is so much as a single space.

- Sanitize your database inputs! Many exploits use unsanitized database inputs.



Happy coding!
hichs
2009-01-22 01:07:00 UTC
my suggestion u go with php it fast and easy to use end you dont need much time to learn in three month you will be make php base web developer or programmer.
James
2009-01-22 01:02:45 UTC
PHP is easier and very useful in web developing while using JAVA may cause some adapting problems for your visitors.(They must have java platform installed on their system.)
parag_pisces
2009-01-22 00:08:10 UTC
php is used only for web devlopment.

Java u can use for web devlopment as well as stand alone application also.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...