www.webdeveloper.com
Results 1 to 2 of 2

Thread: hello

  1. #1
    Join Date
    Nov 2012
    Posts
    1

    hello

    i have been working on a fileshare and i have been getting this error
    Parse error: syntax error, unexpected T_EXIT in /home/a2078156/public_html/func/jspack.php on line 1
    and wondered if anyone could revise it for me. thanks in advance

    PHP Code:
    <?phpif(!defined('CORE'))exit(0);function jspack(&$s){    $s preg_replace(array('/\r\n/s','/\n/s'),'',$s);}?>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,351
    The code you pasted here looks to be missing some line breaks, which may be an indication that the editor you used is not saving it as plain text. It should normally look something like this:
    PHP Code:
    <?php
    if(!defined('CORE'))
    exit(
    0);
    function 
    jspack(&$s){
        
    $s preg_replace(array('/\r\n/s','/\n/s'),'',$s);
    }
    ?>
    Also, while I believe that if() condition will work as intended written that way, I find that for consistency and clarity, it's better to always use the curly braces around what is to be executed, even if it's only one line:
    PHP Code:
    if(!defined('CORE')) {
        exit(
    0);
    }
    function 
    jspack(&$s) {
        
    $s preg_replace(array('/\r\n/s','/\n/s'),'',$s);
    }
    ?> 
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles