jarva or php

They have: 15 posts

Joined: May 2007

i am am just starting out and would like to know what is the best scripted to learn out of jarva or php

greg's picture

He has: 1,581 posts

Joined: Nov 2005

I presume by "jarva" you mean Javascript"? Java is a little different to Javascript.

It depends on what you want to do really.

PHP is excecuted on the server, and Javascript in the browser.
JS (Javascript) can do a few things PHP cannot, but PHP can do more things that JS cannot.

PHP cant instigate a pop up for example, even without the annoying ad pop ups, a confirmation or message pop up is sometimes useful. The alternative with PHP is to load another page with more PHP code and do some calculations and output the result on the page, I.E. "Incorrect login" or whatever.
Of course you can put JS in a PHP file as and when you need it, so the two can be mixed.
JS can't (by itself) connect to a database to get or write info.

JS can be turned off in the browser settings, although it doesn't stop all JS, but if a user has done this some of your scripts won't work for that user. Most coders work around this by providing an alternative to the JS code. You can also easily check if a user has JS enabled in the browser settings, and if YES provide JS ELSE alternative to JS if NO.

JS is very powerful and when you understand the code it can perform fantastic things on your site.
But PHP is also very powerful.

I have never really learned JS because PHP does everything I need (mixed with HTML and CSS).
There are times when I could implement something that JS would be better for, or in fact where only JS will do the task, but it is very rare in my case and I simply work around it with PHP or sometimes CSS.

I think it would be fair to say that people who use JS will also need PHP from time to time, so learning JS you will need to also learn somePHP.
Whereas with PHP you can 'make do' with alternatives to the unique JS abilities.

Most sites these days take advantage of a database, even if it is just storing prices for products. The prices can be obtained from the DB and displayed throughout the site and it's then easy to change those prices in the DB, and they will be changed throughout your site automatically and instantly.
If you ever want to use a database, for example registration and login, you will need PHP (or another language that communicates with a database, not JS).

So, as I said, it depends on what you want to do on websites.
Personally, I would advise learning PHP, then later learn JS or just learn the bits of JS that PHP doesn't have.

They have: 11 posts

Joined: May 2008

I think you can learn java and php together.but java is not javascript.

They have: 10 posts

Joined: May 2008

Thats well defined by developer...

I think php is best for web design these days. More safe and easy to use.

Thanks

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

I agree with developer that it is useful to know both javascript and php

Java can be a very powerful programming language, but on web sites it is generally used for special widgets - "applets" - that are embedded for a specific purpose - or for a standalone internet application that is not really a web site.

I learned javascript first and came to learn php because it was necessary to manage cms sites, such as sites using Drupal (like The Webmaster Forums site).

Along with javascript, it is helpful to have a good understanding of css for dhtml (dynamic html).

I think along with php it is very useful to learn sql for database management.

I often pass variable values between php and javascript and can create some very dynamic pages that way. A php page using javascript for form validation (are the fields filled in? is the email well-formed containing "@" before "."?) and sql to save the name/email pairs in a database and check if an email has already been saved. (Warning - this is a live site and if you enter your email you will be contacted)

This page uses php and sql for search, and javascript and css for the various views depending on the user's actions, but all the different views are actually contained in one page. The "page" itself is made up of about 3 or 4 php files put together (using php you often "include" other php files).

w3schools is a great resource for tutorials and reference; also, Jennifer Kyrnin's excellent About.com site will take you step-by-step learning html, css, how to use javascript and more.

He has: 20 posts

Joined: Dec 2008

DomainZaar wrote:
i am am just starting out and would like to know what is the best scripted to learn out of jarva or php

First of all java is not a scripting language!
If you need to learn a scripting language i recommend you php!
Java is very difficult as server site - JSP and servlets - and without medium or highest knowledge of j2se it is imposible to learn !!!
Success!!

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Ya, I can second that about Java & Servlets. I did a project involving Java Servlets, and it was a pain to set up the environment. PHP is definitely simpler to use.

They have: 32 posts

Joined: Dec 2008

Java is good for large projects
I like coffee Java Wink

They have: 121 posts

Joined: Dec 2008

Both will get the job done, quite well.

It is fairly straight forward to set up a java application server such as tomcat, jboss, or even glassfish. Hosting of a java application will likely be more expensive. PHP will have you see results quicker, which is great for the ego and patience, but dangerous.

I've seen some pretty grand messes made in PHP, and Java alike. I've also seen such elegant solutions in both as to cause a small, beautiful tear rolled down my cheek.

With either choice, I'd recommend reading at least the first few chapters of Bruce Eckel's "Thinking in Java". It is a great introduction into thinking in objects.

Cheers,
Shaggy

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

I would say that as far as hosting goes, PHP is more widely available.

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Shaggy wrote:
PHP will have you see results quicker, which is great for the ego and patience, but dangerous.

PHP has teeth? Doh!

They have: 5 posts

Joined: Feb 2009

javascript only can do the enhancement of the webpages i mean to the client side if u want to be a good webmaster u should have knowledge of php too

They have: 3 posts

Joined: Feb 2009

Hi,
I think both are good. But php is safe and easy to use.PHP shows the results quicker.PHP is more widely available.

They have: 18 posts

Joined: Jan 2009

Personally, I try my hardest to not touch javascript. Browsers don't really understand it properly without having to code for individual ones. Also I don't like php. I think that it's for beginners really. It breaks the Model /View /Controller paradigm and you end up in a grand mess with SQL, HTML, text, PHP, passwords and general crap all in one place. Plus, it's an incomplete language as it can't draw anything.
If you want a couple of pages to display the current time, then I guess PHP is okay, but for any new (non trivial) project I recommend Java with a web framework such as Spring, Struts, Java Server Faces etc.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

It breaks the Model /View /Controller paradigm and you end up in a grand mess with SQL, HTML, text, PHP, passwords and general crap all in one place

False. There are several frameworks that use the MVC approach - Codeigniter, Zend Framework, and CakePHP just to name a few.

Plus, it's an incomplete language as it can't draw anything.

False again. Someone isn't doing their homework. Wink

If you want a couple of pages to display the current time, then I guess PHP is okay, but for any new (non trivial) project I recommend Java with a web framework such as Spring, Struts, Java Server Faces etc.

False. (Although this one is more like an opinion.) There are several large sites that run PHP (I know of plenty). Plus, there are countless PHP projects and software solutions out there, like Wordpress, phpBB, Drupal....

I know I am sounding blunt and possibly rude, but everything you said about PHP was not true, so you need to brush up on your PHP skills before you can argue against it.

They have: 18 posts

Joined: Jan 2009

pr0gr4mm3r,
as to your three points, all I can say is:-
conceded
conceded
conceded
I didn't know a great deal about PHP. I know a lot more now having Googled some of the things you said.

I would say though that because PHP is simple to learn if you don't jump into using frameworks, people risk learning badly. I've seen many books and on-line tutorials that introduce PHP, show how easy it is and then go advanced by sticking a pile of SQL into the page code. Or creating a nice looking page by sticking loads of image fragments in between dynamically generated HTML.
It can quickly end up very messy for the developers, especially if you have separate disciplines like graphics people and database architects.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Very true, but that issue is not with the language, it's with the developer. Applications are only as secure and organized as the developer makes it.

Frameworks IMO help give newbie developers more guidelines to follow and help them to develop good habits early.

I've seen many books and on-line tutorials that introduce PHP, show how easy it is and then go advanced by sticking a pile of SQL into the page code.

3

OK, so that's a problem with the book, not with PHP in general. I've seen equally bad (or worse) books for Java.

They have: 6 posts

Joined: Jan 2012

There are times if I could apparatus something that Java would be bigger for, or in actuality area alone Java will do the task, but it is actual attenuate in my case and I artlessly plan about it with PHP or sometimes CSS.

They have: 11 posts

Joined: Jan 2012

PHP is the best

jeanneluv's picture

She has: 20 posts

Joined: Feb 2012

DomainZaar wrote:
i am am just starting out and would like to know what is the best scripted to learn out of jarva or php

i don't know jarva. maybe what you mean is java, js, or jsp.... i don't know.
java is different to javascript (js) and also different to jsp.

if you talk about database, php is the most used worldwide rather than asp and jsp.

They have: 14 posts

Joined: Jul 2012

I prefer PHP because it is very simple to use and easy learn. It has great user friendly features and best way to develop a attractive website.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.