Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    multisort problem

    Hi,
    Not sure what is wrong with the function of array_multisort(), I have checked line by line, the error tells Parse error:
    parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in d:\easyphp1-8\www\study\array_multisort.php on line 13.
    I don't understand whats wrong with my code which I have copied from php book.

    PHP Code:
    <?php
        $class
    =array("score" =>array(123,345,23,66,7,821,10,33,90,100), "name" =>array("Alice","Peter","Elvin","Sindy","Simon","Bob","Hank","Charlie","Caroline","Linda"));
        `

            
        array_multisort($class
    ["score"],SORT_NUMERIC, SORT_DESC, $class["name"], SORT_STRING, SORT_ASC);
        
        
        echo "<table bgcolor='#ffff99' border='2' width='80%'>";
        echo "<tr><th>Score</th>";
        for($a=0; $a<10; $a++){
            echo "<td>".$class
    ["score"][$a]."</td>";
        }
        echo "</tr><tr><th>Name</th>";
        for($a=0; $a<10; $a++){
            echo "<td>".$class
    ["name"][$a]."</td>";    
        }
    ?>
    Can someone help me out this problem? Much appreciated!

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    There's a superfluous back tick on the third line.

    dumpfi
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))Ż/.
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

  • #3
    New Coder
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dumpfi View Post
    There's a superfluous back tick on the third line.

    dumpfi
    I appreciated. It works after removed this extraneous back tick.


  •  

    Posting Permissions

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