Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Parse Error

  1. #11
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,811
    Thanks
    1
    Thanked 253 Times in 248 Posts

    Default

    Quote Originally Posted by marain View Post
    ...but I believe I'm making progress....

    May I humbly suggest, that you don't hold your breath.

    coothead
    ~ the original bald headed old fart ~

  2. #12
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    284
    Thanks
    95
    Thanked 3 Times in 3 Posts

    Default

    Coothead,

    I'll try the resource you suggested.

    A.

  3. #13
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,811
    Thanks
    1
    Thanked 253 Times in 248 Posts

    Default

    Hi there marain,

    before you go, the reason that I told you that your requirement was
    impossible was because I knew that it was impossible in javascript.

    Here is javascript example...
    Code:
    
    <script>
    (function( d ) {
      'use strict';
    
       var number = 600,
             item = 'apples';
    
       d.querySelector('div').textContent = 
         'We have ' + number + ' green ' + item + ' for you';
    }( document ));
    </script>
    coothead
    ~ the original bald headed old fart ~

  4. #14
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    284
    Thanks
    95
    Thanked 3 Times in 3 Posts

    Default

    Are you sure? What about

    [CODE]const AGE = 25;
    console.log(`I'm ${AGE} years old!`);[\CODE] ?

    See https://www.w3docs.com/snippets/java...avascript.html

    A.

  5. #15
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,811
    Thanks
    1
    Thanked 253 Times in 248 Posts

    Default

    Hi there marain,

    the example you gave is a different kettle of fish.

    1. it is using const rather than var
    2. it is using backticks rather than quotes
    3. the example that I gave used var and
      quotes to match your PHP example

    coothead
    ~ the original bald headed old fart ~

  6. #16
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    284
    Thanks
    95
    Thanked 3 Times in 3 Posts

    Default

    OK. Thanks for your patience.

    A.

  7. #17
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    284
    Thanks
    95
    Thanked 3 Times in 3 Posts

    Default

    Solved! Here is the winning code:

    PHP Code:
    echo "<br /><br />Your final quota of hands for this session was {$numbers[$_SESSION['limit']]}.  This would have been hand number {$numbers[min(($_SESSION['bigCounter']+1),count($numbers)-1)]}. For that reason, we must deny at the moment your efforts for a new hand.  We deny this new hand with respect and with love.  BUT do not dispair:  You can begin a <i>new</i> session when our webmistress returns from {$excuses[(rand(0count($excuses)-1))]}.  She should be coming back in a while.  When she does, it will make her so happy if you are here.  We hope you will not disappoint her.  She will cheerfully review your starting quota of poker hands and, if necessary, adjust it.<br /><br />So hang out or, if necessary, come back later.  Or feel free to refresh your <i>quotation</i>, above.  You can do that while waiting!"
    The problem arose from the fact that when I used the script interpolation method, it became necessary to put braces around ALL of the interpolated variables.

    Coothead, I appreciate the attention to this problem that you provided.

    BTW, the page on which this statement appears (in case anyone is interested) is https://www.marainlaw.com/page.php?here=quotations.

    A.
    Last edited by marain; 01-07-2021 at 09:28 PM. Reason: Provide URL of page in question.

  8. #18
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,811
    Thanks
    1
    Thanked 253 Times in 248 Posts

    Default

    Quote Originally Posted by marain View Post
    Solved! Here is the winning code:.

    Very well done!!!

    Thanks for proving me wrong.

    coothead
    ~ the original bald headed old fart ~

  9. #19
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    284
    Thanks
    95
    Thanked 3 Times in 3 Posts

    Default

    Trust me: That will not happen very often ;-)

Similar Threads

  1. Resolved Parse error: syntax error unexpected 'echo'
    By Kage Kazumi in forum PHP
    Replies: 3
    Last Post: 10-21-2012, 08:19 PM
  2. Replies: 1
    Last Post: 01-28-2011, 03:39 AM
  3. Parse error: syntax error, unexpected $end
    By heavensgate15 in forum PHP
    Replies: 2
    Last Post: 02-24-2010, 06:38 AM
  4. Replies: 2
    Last Post: 02-12-2010, 09:53 AM
  5. Replies: 1
    Last Post: 04-26-2008, 11:22 AM

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
  •