Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    sweden
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why am I not getting linefeeds?

    This code is running on RedHAt, Apache 1.3 with PHP 4.3.6
    The \n's in the header variable just shows as \n. no breaks nospaces no binary space...

    PHP Code:
    $header = '<?php $use_zlib=''.$use_zlib.'\';\n if(!file_exists(\'freelock.php\')) { echo "freelock not found - exiting"; exit; }"'.$s.'\n<?php include_once(\'freelock.php\');?><?php freelock_run($s1); ?>';
      if(
    $output == '') {
        
    $fp fopen($file,'wb');
        
    fwrite($fp,$header,strlen($header));
        
    fclose($fp);
      } else {
        
    $fp fopen($output.'/'.basename($file),'wb');
        
    fwrite($fp,$header,strlen($header));
        
    fclose($fp);
      }
    Carl McDade
    _____________
    Hiveminds Magazine
    for web publisher and community builders
    eRuby Tutorials

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    to get a linebreak in your source (html-source) you can only use

    "\n" --> needs to be surrounded by double quotes
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    sweden
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Arrrgh!!!

    I new there was a reson I only use double quotes. This is someone elses code. Had me up until 3am.

    Thanks Raf
    Carl McDade
    _____________
    Hiveminds Magazine
    for web publisher and community builders
    eRuby Tutorials

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you're welcome.

    actualy, i also use single quotes for strings, except for sql-querys, eval()'ed code and the formatting codes. because everything between doublequotes is parsed, which is in most case not required.

    so if i wan't to layout my sources, then i'll have

    echo 'some javascript i need to be able to read' . "\n" ;
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I also use single quotes for regexps, they are almost always meant to be taken literally.


  •  

    Posting Permissions

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