HTML VS PHP - Who Wins? - Khorgist.com

Breaking

Post Top Ad

Advertise Here

Post Top Ad

STAY SAFE




Friday 6 October 2017

HTML VS PHP - Who Wins?

PHP is the author, HTML is the publisher.

HTML means Hypertext Markup Language and, along with CSS and Javascript,it is called the front-end.
PHP means Hypertext Preprocessor and it is a server-side scripting language. This is the back-end.

Front End in essence simply means the part which Users can see. Example include this live site.
while Backend implies that part of the system whereby only the Admin and those with access level are able to see. Examples include - Database of Users.

HTML can run from your desktop too. If you’ve got a file index.html sitting on your desktop, you can just double click on it and it’ll open up and render the text on your browser. PHP, on the other hand, requires a Web Server to run on.
PHP is used server-side to get information from a database or something else that needs to be done on the server. You can then use html (where all the work is done in the user's browser) to make that data look pretty.
So, PHP’s main job is to process some data and render it in a language the browser understands (which is HTML).
Now Lets go Practical


If you’ve got a webpage you want to display a message on: ‘Hi There!’, here’s how you would do it in HTML:
<h1>Hi There!</h1>
And in PHP:
echo ‘<h1>Hi There!h1>’;
Your HTML file will be named with the extension ‘.html’, whilst your PHP file will have the extension .php.
now,

Here’s some code I stole off Mobile Detect (a PHP library)

  1. // Include and instantiate the class.
  2. require_once 'Mobile_Detect.php';
  3. $detect = new Mobile_Detect;
  4. // Any mobile device (phones or tablets).
  5. if ( $detect->isMobile() ) {
  6. echo "You're probably on a phone! ";
  7. }

No comments:

Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

Post a Comment

Post Top Ad




Do you ever witness news or have a story that should be featured on Khorgist ?
Submit your stories, pictures and videos to us now via WhatsApp: +2347064258615, Social Media @khorgist_com: Email: Khorgist@gmail.com More information here.