Need PHP Expert Opinion

Discussion in 'Free Talk for Website Owners and Webmasters' started by eqewebmaster, Jul 9, 2009.

  1. eqewebmaster

    eqewebmaster New Member

    Joined:
    Jun 29, 2009
    Messages:
    21
    I want a "Last Updated: ....." display on my article pages, and in my searches I've come across two scripts.

    Code A
    Code:
    <?php echo date( "F d, Y", getlastmod() );?>
    Basically, "Set it and forget it." All I have to do is insert this code, and it'll update whenever I make a modification (aka re-upload) the page. However, some people have said that this code isn't as "good" as this one...

    Code B
    Code:
    <?php
    $last_modified = filemtime("Untitled.php");
    print("Published: ");
    print(date("m/j/y", $last_modified));
    ?>
    This code is supposed to be "better" than Code A, however if I were to use this code then I'd have to manually insert the page(file) name [see "Untitled.php"] in each and every page.

    So for all the PHP code wizards out there...is there really any issues with using either code? Is A less reliable or unstable than B? I'd prefer to use Code A, but now I'm wary because of this supposed inferiority to B.

Share This Page