Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
If I wanted to print out Code: <?php ?> how can I do this? I was using echo "\<\?php \?\>" but it doesn't work. Reading through the manual, I don't ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    Printing out characters


    If I wanted to print out
    Code:
    <?php ?>
    how can I do this? I was using echo "\<\?php \?\>" but it doesn't work. Reading through the manual, I don't see how I can achieve this.
    The best things in life are free.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    What do you mean? Through PHP code or through HTML? HTMl would be easy:
    Code:
    &lt;?php ?&gt;
    If you mean through PHP code, this works for me:
    Code:
    print&#40;"<?php ?>"&#41;;
    Of course, the <>'s will make your browser not display it since it will think that it is HTML. So I guess that what you really want is a combination.

  3. #3
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Got it. A combination such as print( "&lt;?php &gt;" ) should suffice. Not that this pertains to this problem but is it just me or do you too find scripting languages harder to write and debug?
    The best things in life are free.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    Quote Originally Posted by bpark
    Not that this pertains to this problem but is it just me or do you too find scripting languages harder to write and debug?
    As opposed to what?

    I think any language, providing you know it well and your code is well structured etc is easy to debug and write.

    Obviously there are differences between what each language will allow you to do, even finding a good, consistent coding style can help a lot.

    Jason

  6. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'd say it depends. The thing is, of course, that there isn't any debugger for PHP, which makes it a lot harder than debugging any language that eg. gdb can handle. The same goes for many other scripting languages as well, like perl and bash scripting. It is a bit simplified by the fact that the PHP engine gives verbose errors as opposed to a C program that might just segfault on you. That's why it depends, since it can make some simple situations really easy to debug.

  7. #6
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Well,

    This past week, I was writing simple CGI scripts in PERL. I think I was missing one character and it kept on giving me a very dull message about how the code is wrong or that the system admin needs to give me permissions. I looked at that code for about 20 minutes before I realized that a hash array's starting body brace was typed with a '{' instead of a '('.
    Thinking about this type of error, perhaps I find g++ or gcc's output better since I'm used to programming in those languages. The PERL problem has been taken care of but I must say that PHP's error detection is pretty good at giving the user where the error lies within the code.
    The best things in life are free.

  8. #7
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Indeed, the compiling errors may be clearer when using gcc, but runtime errors can be really hard to work out, espacially if they're one-shot.

  9. #8
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    Yes i think the PHP errormessages are pretty good, Perl is a bit worse. Does anybody know if i can execute my perlprograms with any debug-flag?? like in shellscripting sh -x <shellscript> to see exactly where the program goes wrong??.

    That would make the world easier....
    Regards

    Andutt

  10. #9
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Are you referring to perl -w?

  11. #10
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Even with 'perl -w', unless you are using it from the command line and specifying the parameters, it will not give you a good description at all.
    The best things in life are free.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •