1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Php Stntax Error Solve Please

Discussion in 'PHP' started by aCebOy, Jan 23, 2013.

  1. #1
    Dear, I'm Trying tO Set A Syntax, But I Can't,
    Look,
    In This
    $Page1h = "<H3>Some Thing</H3>";
    $Page1p = "Some Thing";

    I Want tO Add A Syntax Like
    $PageNum = "1";
    In This
    $Page<?php echo $PageNum ;?>h = "<H3>Some Thing</H3>";
    $Page<?php echo $PageNum ;?>p = "Some Thing";
    But Found A Syntax Error, Please Help Me tO Correct It Please ..

     
    aCebOy, Jan 23, 2013 IP
  2. Sano000

    Sano000 Active Member

    Messages:
    52
    Likes Received:
    4
    Best Answers:
    5
    Trophy Points:
    53
    #2
    
    $Page{$PageNum}h = 'something';
    
    PHP:
    But better way to use arrays or objects;
     
    Sano000, Jan 23, 2013 IP
  3. phpexperts

    phpexperts Greenhorn

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    21
    #3
    to fix that you have to define variable name like this

    ${'page'.'$PageNum' .'h'}

    now this variable and it's output like

    echo $Page1h; // Some Thing
     
    phpexperts, Jan 23, 2013 IP
  4. Sano000

    Sano000 Active Member

    Messages:
    52
    Likes Received:
    4
    Best Answers:
    5
    Trophy Points:
    53
    #4
    Ups, yes phpexperts is right
    ${'Page'.$PageNum.'h'}
     
    Sano000, Jan 23, 2013 IP
  5. wiicker95

    wiicker95 Well-Known Member

    Messages:
    438
    Likes Received:
    37
    Best Answers:
    10
    Trophy Points:
    100
    #5
    You cannot post a same thread twice.

    https://forums.digitalpoint.com/threads/parse-error-syntax-error-unexpected-t_constant_encapsed_string-in.2629306/

    Reported
     
    wiicker95, Jan 23, 2013 IP
  6. aCebOy

    aCebOy Banned

    Messages:
    68
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    36
    #6
    @wiicker95
    Sorry Dear ..:(
     
    aCebOy, Jan 23, 2013 IP
  7. aCebOy

    aCebOy Banned

    Messages:
    68
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    36
    #7
    Oh yEah, Syntax Is Correct, ThaNks Alot .. ;)
     
    aCebOy, Jan 23, 2013 IP