Announcement

Collapse
No announcement yet.

combining 2 variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • combining 2 variables

    im trying to combine like two variables

    $at==$account$ct;

    i want it so that it knows that the variable is $account0 $ct=0

  • #2
    "==" != "="

    $at = $account.$ct;
    or
    $at = "$account$ct";

    Comment


    • #3
      alright now when i do this it prints 0...however when i did $account0 it printed out what i wanted... so why does the $account.$ct print out just 0 when $ct=0?

      Comment


      • #4
        You have vars name $account0, $account1, etc?

        Try:

        $at = ${"account".$ct};

        or

        $varname = "account$ct";
        $at = $$varname;

        [edit] forgot a ; [/edit]

        [Edited by JohnM on 01-20-2001 at 08:06 PM]

        Comment


        • #5
          Oh, THAT's what you meant.

          Comment


          • #6
            This place is unbelievable.

            I spent a couple of hours reading through the PHP manual trying to find the answer to this EXACT question. Eventually I gave up and decided to come here and post a question, hoping someone will know.

            And there it is, the answer's already here

            Thanks a ton JohnM!!!!

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X