echo "<?php"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonny T

    echo "<?php"

    hi,
    i want to echo the string '<?php' in a php script like :

    echo "<?php";

    but when i try nothing gets displayed ...

    if I use

    echo "<\?php";

    then the string is displayed as : <\?php

    Is there anything I can do ??
  • Jon Kraft

    #2
    Re: echo &quot;&lt;?php& quot;

    Jonny T <jonnyt@someisp 3.com> wrote:
    [color=blue]
    > i want to echo the string '<?php' in a php script like :
    >
    > echo "<?php";
    >
    > but when i try nothing gets displayed ...
    >
    > if I use
    >
    > echo "<\?php";
    >
    > then the string is displayed as : <\?php
    >
    > Is there anything I can do ??[/color]

    Yes, have a look at the HTML source.

    JOn

    Comment

    • Dennis Biletsky

      #3
      Re: echo &quot;&lt;?php& quot;

      use htmlspecialchar s like this
      $phpstrsp="<?ph p";
      $phpstrsp=htmls pecialchars($ph pstrsp);
      echo $phpstrsp;


      "Jonny T" <jonnyt@someisp 3.com> ???????/???????? ? ???????? ?????????:
      news:c4ek8o$ic3 $1@sparta.btint ernet.com...[color=blue]
      > hi,
      > i want to echo the string '<?php' in a php script like :
      >
      > echo "<?php";
      >
      > but when i try nothing gets displayed ...
      >
      > if I use
      >
      > echo "<\?php";
      >
      > then the string is displayed as : <\?php
      >
      > Is there anything I can do ??[/color]


      Comment

      • Ike

        #4
        Re: echo &quot;&lt;?php& quot;

        Just looking at how I have done it succesfully in the past as....
        $fp = fopen($savename , "w+");
        fputs($fp, "<?php" . "\n");

        //-Ike


        "Jonny T" <jonnyt@someisp 3.com> wrote in message
        news:c4ek8o$ic3 $1@sparta.btint ernet.com...[color=blue]
        > hi,
        > i want to echo the string '<?php' in a php script like :
        >
        > echo "<?php";
        >
        > but when i try nothing gets displayed ...
        >
        > if I use
        >
        > echo "<\?php";
        >
        > then the string is displayed as : <\?php
        >
        > Is there anything I can do ??[/color]


        Comment

        • Guest's Avatar

          #5
          Re: echo &quot;&lt;?php& quot;

          "Jonny T" <jonnyt@someisp 3.com> wrote in message
          news:c4ek8o$ic3 $1@sparta.btint ernet.com...[color=blue]
          > i want to echo the string '<?php' in a php script like :
          >
          > echo "<?php";
          >
          > but when i try nothing gets displayed ...[/color]

          Try:
          echo "&lt;?php";

          -or-

          echo '<?php';


          Comment

          • Ian.H

            #6
            Re: echo &quot;&lt;?php& quot;

            On Wed, 31 Mar 2004 14:23:21 +0000, Jonny T wrote:
            [color=blue]
            > hi,
            > i want to echo the string '<?php' in a php script like :
            >
            > echo "<?php";
            >
            > but when i try nothing gets displayed ...
            >
            > if I use
            >
            > echo "<\?php";
            >
            > then the string is displayed as : <\?php
            >
            > Is there anything I can do ??[/color]


            echo '&lt;php'


            You need to use the HTML entities character for '<' which is '&lt;'
            (LessThan). This will also be valid (X)HTML too where '<?php' would not
            even if it was displayed as you expected =)



            Regards,

            Ian


            [XP honoured.. FU: comp.lang.php]

            --
            Ian.H
            digiServ Network
            London, UK


            Comment

            Working...