Jump to content

Php beginner

Hi!

 

So i started php today, and im doing some exercises atm, and  i wonder how can i do php calculator for user input, like 

<?php
       $value1 = $_POST['production'];
       $value2 = $_POST['amount']; 
	   $value3 = $_POST['price'];   
	   	echo $value1 + $value2 + $value3);
?>

i did research for 2 hours and i didnt find anything related to this

Link to comment
Share on other sites

Link to post
Share on other sites

my advice is to chose a different language.

any language that uses a full stop for string concatenation is a broken language

Link to comment
Share on other sites

Link to post
Share on other sites

14 minutes ago, ImNotThere said:

my advice is to chose a different language.

any language that uses a full stop for string concatenation is a broken language

There are many different things wrong with php that are way worse than the full stop.

See: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

Some comments in that post are pure gold

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, ImNotThere said:

my advice is to chose a different language.

any language that uses a full stop for string concatenation is a broken language

What the hell :o If PHP is so bad why do 83% of websites use it?

Link to comment
Share on other sites

Link to post
Share on other sites

PHP is awesome for just getting a slightly dynamic website up and running because almost every single web hoster supports it by default. Try that with other languages.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, MyName13 said:

What the hell :o If PHP is so bad why do 83% of websites use it?

its bad, doesnt mean its useless

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, bomberblyat said:

what use instead of php then?

PHP is fine, there will be always talk about the flaws of a language.

It is still a high language in web development, Mostly because of WordPress probably (Blegh).

 

IMO You shouldn't bother yet which language is the best or something, just create something the drama about what language using when and for what is for later.

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

If it was about the best language, you should write your websites in C. But many webhosts won't let you run FastCGI applications for security reasons.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Dat Guy said:

PHP is awesome for just getting a slightly dynamic website up and running because almost every single web hoster supports it by default. Try that with other languages.

What about Python (django), ruby (RoR) and JS (NodeJS)?

 

46 minutes ago, ImNotThere said:

its bad, doesnt mean its useless

It makes sense to switch from bad things to good things.

 

31 minutes ago, Dat Guy said:

If it was about the best language, you should write your websites in C. But many webhosts won't let you run FastCGI applications for security reasons.

C certainly isn't the best language (websites can't even be written in C, that's what HTML and CSS are for).

Link to comment
Share on other sites

Link to post
Share on other sites

@bomberblyat I'm sorry that you have to witness this, this thread its next comments will be only arguing about languages and it won't get much interesting for now.

Let the boys fight and don't really care anymore, for further questions just make a new thread :)

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, MyName13 said:

What about Python (django), ruby (RoR) and JS (NodeJS)?

Not available by default on most web hosters, especially the cheaper ones.

 

5 minutes ago, MyName13 said:

websites can't even be written in C, that's what HTML and CSS are for

Websites can't be "written in" PHP either because browsers can't run it. Websites can, however, be generated in it.

 

(This is increasingly less true since you can write WebAssembly binaries in C - but this is quite an immature technology yet.)

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Dat Guy said:

Not available by default on most web hosters, especially the cheaper ones.

 

Websites can't be "written in" PHP either because browsers can't run it. Websites can, however, be generated in it.

 

(This is increasingly less true since you can write WebAssembly binaries in C - but this is quite an immature technology yet.)

Why don't they provide support for these languages then?

 

Of course they can't because they're used for the back end functionality, not UI design (or front end functionality).

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, MyName13 said:

Why don't they provide support for these languages then?

Ask them, not me.

 

1 minute ago, MyName13 said:

Of course they can't because they're used for the back end functionality, not UI design (or front end functionality).

Huh? Bullshit, sorry.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dat Guy said:

Huh? Bullshit, sorry.

So you're telling me that every programming language can be used on the front end (for GUI and functionality)?As far as I know web browsers support only HTML, CSS and JS.

Link to comment
Share on other sites

Link to post
Share on other sites

And WebAssembly. And nobody said that HTML can't be generated - and the generating code is front-end code. Not everything has a "backend".

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Dat Guy said:

Not everything has a "backend".

 

And nobody said that HTML can't be generated - and the generating code is front-end code.

I know that.

 

If you're talking about JS's ability to alter web pages, I still have no idea how that answers my question.How do you write a GUI and front end functionality in C, C++, C#, Java, Python etc. for a browser (unless you're talking about WebAssembly)?

Link to comment
Share on other sites

Link to post
Share on other sites

Depends. How does WordPress do that without a single HTML file?

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Dat Guy said:

Depends. How does WordPress do that without a single HTML file?

I've never used WordPress so I don't know.Does WP really not create HTML, CSS and JS files?What do browsers receive from the server then?

Link to comment
Share on other sites

Link to post
Share on other sites

Browsers receive HTML that was generated with PHP.

 

You suggested Python, Ruby and Node.js. Why do you assume that C wouldn't work instead?

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dat Guy said:

Browsers receive HTML that was generated with PHP.

 

You suggested Python, Ruby and Node.js. Why do you assume that C wouldn't work instead?

Browsers still receive HTML, not some other code (I thought you said that something else can be used DIRECTLY (like sending Java, C etc. code to browsers to create GUI)).

 

For back end?I didn't say it wouldn't work, I said that it isn't the best language.

Link to comment
Share on other sites

Link to post
Share on other sites

You still mix up "backend" with "server-side logic".

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Cruorzy said:

@bomberblyat I'm sorry that you have to witness this, this thread its next comments will be only arguing about languages and it won't get much interesting for now.

Let the boys fight and don't really care anymore, for further questions just make a new thread :)

Alright

Link to comment
Share on other sites

Link to post
Share on other sites

Guest
This topic is now closed to further replies.

×