What is the PHP equivalent of <a href>?

Discussion in 'PHP' started by Devilfish, Nov 24, 2008.

  1. #1
    Hi folks,

    Can someone tell me what the php equivalent of <a href=""></a> is please?

    Thanks :)
     
    Devilfish, Nov 24, 2008 IP
  2. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #2
    There's none.
    PHP is a server-side language, and will not make any code the user can interact with, since all parsing is done before the user gets the output.
    If you write:
    
    <?
    if($_GET[test] == "yes"){
    echo "YES";
    }else{
    echo "NO";
    }
    ?>
    
    PHP:
    You wouldn't see that code if you're viewing the page source.
    if you just go to filename.php, it will say "NO" in the source, if you visit filename.php?test=yes, it will say "YES" in the source.
    You're not able to see if(....) etc, because that parsing is done server-side.

    To write a link to the html, you would simply use:
    echo '<a href="something">Visit my website</a>';
     
    elias_sorensen, Nov 24, 2008 IP
  3. joxtechnology

    joxtechnology Peon

    Messages:
    146
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    there's no equivalent code. if your going to create a link in php you'll also use that tag.
     
    joxtechnology, Nov 25, 2008 IP