PHP vs HTML ?

Discussion in 'HTML & Website Design' started by Jason Foster, Sep 1, 2013.

  1. #1
    Looking forward to have comparison between PHP and HTML. What do you think about them?
     
    Jason Foster, Sep 1, 2013 IP
  2. nenen

    nenen Member

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    2
    Trophy Points:
    35
    #2
    It really shouldn't be PHP vs HTML cause you can not compare between sun and the moon but you can compare between PHP vs ASP.

    Web pages are documents composed using HTML Markup while PHP is a Server-side scripting language that performs delivery and processing tasks.

    But generally some of the difference of PHP and HTML

    1. PHP is similar to HTML because PHP having both HTML and PHP code.
    2. HTML is a Tag language but PHP is a scripting language.
    3. The output of PHP is mostly in HTML code because the web browser only sends HTML codes and PHP code always in background.
    4. Actually web page takes two numbers, add it and present to user which easily done by PHP but which is not possible in HTML.

    You won't find any sites that are built with only PHP, because PHP by itself is not capable of rendering a web page without using HTML. You will find web services that use PHP + some output format other than HTML, like XML or JSON, but those are designed strictly to be read by other computer programs, not by humans.

    Example of html <-- this is static

    <font face="tahoma" size="2px" color="red">4*2=8</font>
    HTML:
    Example of PHP <--- this is dynamic and printed as html

    <?PHP
    $value1 = "4";
    $value2 ="2";
    $total = $value1*$value2;
    echo "<font face=\"tahoma\" size=\"2px\" color=\"red\">$total</font>";
    ?>
    PHP:
    Both example giving same output but at php you can adjust any of the value and let it do the task without have to write it already.

    so it is operational language while html is static

    Thanks and hope it helps
     
    nenen, Sep 1, 2013 IP
    topcoder and khemraj like this.
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Yeah that question REALLY doesn't make any sense whatsoever -- since the purpose of PHP is to output HTML... -- hence the recursive abbreviation: PHP: Hypertext Preprocessor. It's made to pre-process hypertext -- the primary hypertext in question BEING HTML -- HyperText Markup Language.

    Though that's why it's a laugh when you come across people who call themselves PHP "experts", but then don't know enough HTML to be using PHP for a blasted thing in the first place.
     
    deathshadow, Sep 1, 2013 IP
  4. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #4
    Both are different language. you cannot compare each-other.
     
    creativewebmaster, Sep 2, 2013 IP
  5. Shailesh555

    Shailesh555 Greenhorn

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    PHP means Hypertext Preprocessor and HTML means Hypertext Markup Language.
    PHP is an HTML-embedded scripting language. and It is use to create portal's like Ebay,homeshop18 etc. while HTML is used to create simple website.
     
    Shailesh555, Sep 2, 2013 IP
  6. juschan45

    juschan45 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #6
    We all know the basic differences between html & php is,
    Html is a language used for creating static pages whereas php- a language is used for creating dynamic web pages.
    html is an abbreviation for HyperText Markup Language where as PHP stands for Hypertext PreProcessor or Personal Home Page.
    html is a client side language where as php is a serverside programming language.

    Still there is a lot to know. you may search online for more.
     
    juschan45, Sep 2, 2013 IP
  7. korfezli1966

    korfezli1966 Well-Known Member

    Messages:
    289
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    165
    Digital Goods:
    1
    #7
    Html is the cover of a book but the php is the content of the book. YYou can not compare them.
     
    korfezli1966, Sep 2, 2013 IP
  8. ruben.idh

    ruben.idh Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #8
    Imagine that you can modify your house. You can change the color of the wall, the style of the doors, the height of the roof, etc.
    And imagine you can change it saying magical words like "Change the color of the wall to orange only when it's friday and it's raining outside". The physical elements: wall, door, roof, color, etc are the same as HTML.
    The magical words are PHP.
    With PHP you can change, create or remove the HTML using a special language.

    Hope it helps.
     
    ruben.idh, Sep 2, 2013 IP
  9. prologic

    prologic Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #9
    Both of them are completely different languages.

    php is a server side programming language whereas HTML is a simple markup language used for basic structure of a website, php can control all the server functionalities and much more.
     
    prologic, Sep 2, 2013 IP
  10. Nothingstopspeed

    Nothingstopspeed Greenhorn

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #10
    HTML is the best choice to create static website while PHP is mainly used to create dynamic website, PHP can be combined with database which make you manage and update your website easily and effectively, this is good if your website has a great number of contents or pages.

    However, in my personal opinions, I'd prefer HTML to create my own website because HTML is well recognized by search engines like Google. If you run a small online business, I think you should choose HTML.
     
    Nothingstopspeed, Sep 3, 2013 IP
  11. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #11
    Since PHP OUTPUTS HTML, how the **** does it make ANY difference in terms of SEO?

    The answer is, it doesn't... So like MOST of the responses and even the OP's question, your post doesn't make any sense.

    To be brutally frank, people are dumber for having read around half the responses in this thread.
     
    deathshadow, Sep 3, 2013 IP
  12. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #12
    No, I would NEVER use that comparison because the job of HTML is NEVER to say what it looks like. That's CSS' job!

    PHP is for gluing together data (like from a database) to the markup (HTML) -- the HTML should say what things are, CSS is then for what things look like for each of your media targetS. (Yes, PLURAL!)

    Unless of course you have your head wedged up 1997's arse.
     
    deathshadow, Sep 3, 2013 IP
  13. khemraj

    khemraj Well-Known Member

    Messages:
    400
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    125
    #13
    absolutely right, there is no comparison between PHP and HTML. though it can be PHP vs .Net but can't be HTML vs PHP. HTML is to make your website active and PHP is the make those active sections functional (forms, and other call to actions)
     
    khemraj, Sep 3, 2013 IP
  14. ruben.idh

    ruben.idh Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #14
    You're right. +1 for your contribution.
     
    ruben.idh, Sep 3, 2013 IP
  15. topcoder

    topcoder Well-Known Member

    Messages:
    125
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    138
    #15
    HTML is something you need to know if you're programming websites

    PHP, PERL, java, ASP, .net, etc are programming languages you will use with HTML to build a website with functionality.
     
    topcoder, Sep 4, 2013 IP
  16. Jeffrey Witt

    Jeffrey Witt Member

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #16
    I think of PHP and HTML as being very similar with subtle differences, as the base of PHP IS HTML obviously, but it is the lesser known facts that tend to break it down better.

    For example with SEO Alot of webmasters think that html pages are ranked well than PHP extension . First of all thats not true, it depends on how you use php .

    As pulse added the problem is related to the fact that PHP uses in some cases session ids in the url and since session changes from user to user the URL looks different at the “eyes” of a search engine. PHP pages are dynamic so you will find in most cases question marks in the url

    Google doesnt seem to pay lots of attention to this since it means dynamic conent, maybe automatic information and marks that as not so relevant information. Poeple use dynamic page sto fool search engines and Google pays attention to that also.
     
    Jeffrey Witt, Sep 4, 2013 IP
  17. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #17
    While I'm left wondering where the **** people come up with that idiotic nonsense. PHP is a programming language that is TYPICALLY used to output HTML, the language itself is based on C, not HTML. There is nothing "Similar" about them as they are two separate entities with little if anything in common! Subtle differences?!? They are light years APART.

    Seriously, after some three decades of programming when I see statements like that I really wonder just what the blue blazes is in the kool-aid. People are dumber for having read posts like that.

    Of course, that the rest of it with the talk of the URL's reeks of SEO-Tard scam artists nonsense...
     
    deathshadow, Sep 5, 2013 IP
  18. Jeffrey Witt

    Jeffrey Witt Member

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #18
    what are you talking about. Are you seriously saying that php and html have nothing in common? WOW
     
    Jeffrey Witt, Sep 5, 2013 IP
  19. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #19
    I would say so. In fact php and html are totally unrelated.

    PHP is a true programming language, not a markup language. It manipulates data, usually as variables, through functions and methods (to use the Pascal terms). It gets its data from the server as name/value pairs, or from a database flat file or an rdbms through an api. PHP doesn't care where or what it gets as long as it meets requirements of its own api. It then either prints the results in whatever form the programmer codes in, say html or xml or gobbledy-gook, or it exports hash lists or arrays to, say, a templating engine where it is formatted for the UA, again in whatever form is needed. HTML need never be in the mix at all.

    cheers,

    gary
     
    kk5st, Sep 5, 2013 IP
  20. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #20
    Correct, while PHP was created to pre-process HTML, it doesn't have to have ANY HTML inside it. People use it to output XML -- they use it to output CSS (stupid, but people do it) -- you can even use the GD module to make it output

    Syntactically it has NOTHING to do with XML, SGML or HTML, it is a C syntax language. Just because you can echo out HTML or have HTML outside the crappy PHP tags of <?php ?>, and it was created to glue HTML bits together with data from other sources, does not mean it has jack **** to do with HTML so far as the language's format, structure and function is concerned.

    Seriously, you think THIS is 'similar' to HTML?!? On what planet?

    <?php
    // Set the content-type
    header('Content-Type: image/png');
    
    // Create the image
    $im = imagecreatetruecolor(400, 30);
    
    // Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);
    
    // The text to draw
    $text = 'Testing...';
    // Replace path by your own font path
    $font = 'arial.ttf';
    
    // Add some shadow to the text
    imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
    
    // Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
    
    // Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
    ?>
    Code (markup):
    HTML doesn't have functions, variables, control structures or logic flow. It is a markup language, PHP is a programming language. Realistically apart from the fact PHP can output HTML, they are nothing alike and have little if anything in common.

    Though again, if you're one of those re-re's who puts <?php ?> on every blasted line of your code for no good reason other than code bloat and coder ineptitude, you might not see that... but again that's why I'd like to see <?php and ?> stricken from the PHP language entirely, they just encourage half-assed sloppy coding and prevents certain developers from ever grasping the point of having a programming language under their website in the first place.

    Basically, you might have HTML in your PHP code in the same file -- that doesn't make that HTML be PHP... it's still just HTML being output AS HTML, it's just in your PHP.
     
    deathshadow, Sep 5, 2013 IP