Professional Web Applications Themes

I have a newbie newbie question, is this the right forum? - PHP Development

I have a "test" file, learning php... this file ("hmbg.net/php/test.php") ------------------------------------------ <?php //functioned version of echoing dates function addDay($timestamp) { //this function adds 86400 seconds to a epoch timestamp. $newTimestamp = $timestamp + 86400; return $newTimestamp; } $timestamp = time(); $aDayFromNow = addDay($timestamp); $twoDaysFromNow = addDay($aDayFromNow); echo 'Today: '.$timestamp.'<br />'; echo 'Tomorrow: '.$aDayFromNow.'<br />'; echo 'The Day after Tomorrow: '.$twoDaysFromNow.'<br />'; ?> ------------------------------------------ produces: P error: p error, unexpected T_STRING in /customers/hmbg.net/hmbg.net/httpd.www/php/test.php on line 8 and... I can not understand why? line 8 is: $newTimestamp = $timestamp + 86400; I have the file as "clean" as written above. Can anyone ...

  1. #1

    Default I have a newbie newbie question, is this the right forum?

    I have a "test" file, learning php...

    this file ("hmbg.net/php/test.php")

    ------------------------------------------
    <?php

    //functioned version of echoing dates
    function addDay($timestamp) {
    //this function adds 86400 seconds to a epoch timestamp.
    $newTimestamp = $timestamp + 86400;
    return $newTimestamp;
    }

    $timestamp = time();
    $aDayFromNow = addDay($timestamp);
    $twoDaysFromNow = addDay($aDayFromNow);

    echo 'Today: '.$timestamp.'<br />';
    echo 'Tomorrow: '.$aDayFromNow.'<br />';
    echo 'The Day after Tomorrow: '.$twoDaysFromNow.'<br />';

    ?>
    ------------------------------------------
    produces:

    P error: p error, unexpected T_STRING in
    /customers/hmbg.net/hmbg.net/httpd.www/php/test.php on line 8

    and...
    I can not understand why?

    line 8 is: $newTimestamp = $timestamp + 86400;

    I have the file as "clean" as written above.

    Can anyone show me the light?
    Thank you in advance.
    /Hans.




    Hans Guest

  2. #2

    Default Re: I have a newbie newbie question, is this the right forum?

    Same as Chris Martin's query earlier.
    UNTERMINATED STRING CONSTANT
    would be a more user friendly error message.






    "Hans M" <com> wrote in message
    news:BDB423EB.3D25%com... 


    Fabian Guest

  3. #3

    Default SV: I have a newbie newbie question, is this the right forum?

    Thank you.
    I tried to find how to adjust that, but failed.
    May I ask someone to tell me where that UNTERMINATED STRING CONSTANT
    is, and how to correct it. I made attempts, but I can not get what's
    wrong.

    /Hans.
     
     
    >
    >[/ref]

    Hans Guest

  4. Moderated Post

    Default Re: I have a newbie newbie question, is this the right forum?

    Removed by Administrator
    Fabian Guest
    Moderated Post

  5. #5

    Default Re: I have a newbie newbie question, is this the right forum?

    > function addDay($timestamp) { 

    Hi,

    All is not what it seems!!

    I messed around with the above code and could not get an error,
    until I cut and pasted the actual code from the posting!

    If you remove the 'space' before the //, then it works!
    In a hex editor I see that you in fact do not have 5 spaces (hex20)
    "20 A0 A0 A0 A0" ie
    //

    You managed to get some 'space junk' into your code!!

    Reddog.

    Reddog Guest

  6. #6

    Default Re: SV: I have a newbie newbie question, is this the right forum?

    > function addDay($timestamp) { 

    Hi,

    All is not what it seems!!

    I messed around with the above code and could not get an error,
    until I cut and pasted the actual code from the posting!

    If you remove the 'space' before the //, then it works!
    In a hex editor I see that you in fact do not have 5 spaces (hex20)
    "20 A0 A0 A0 A0" ie
    //

    You managed to get some 'space junk' into your code!!

    Reddog.

    Reddog Guest

Similar Threads

  1. A newbie with a newbie question
    By dusty_davis@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 5
    Last Post: October 14th, 07:54 AM
  2. beyond a newbie question...3ds...
    By dp63130 webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 4
    Last Post: February 2nd, 03:31 PM
  3. newbie - about php, a forum and a showcase
    By Gernot Frisch in forum PHP Development
    Replies: 1
    Last Post: January 27th, 02:55 PM
  4. newbie oop in php question
    By Lol McBride in forum PHP Development
    Replies: 2
    Last Post: November 21st, 10:13 AM
  5. PHP Newbie - Question
    By Ryan Sullivan in forum PHP Development
    Replies: 2
    Last Post: October 1st, 12:50 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139