Link to home
Start Free TrialLog in
Avatar of Samson Gilkinson
Samson Gilkinson

asked on

CS6 Adobe Dreamweaver Alphanumeric list

Hello,
         I have an issue with cs6 that i can not figure out. I have tried sorting with php, however it doesn't seem to work. I have spent 1 hour researching this and cannot find an answer to how to sort it, please help. I need to alphanumerically order this array.
      var products =["Printer","Tablet","Router"];
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

var products =["Printer","Tablet","Router"];

what programming language is referring to as what showing above?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you have array in php, after is the wrong syntax, and you can try this instead:
<?php
$products = array("Printer","Tablet","Router");
$clength = count($products);

echo "Before:<br>";

for($x = 0; $x < $clength; $x++) {
    echo $products[$x];
    echo "<br>";
}

sort($products);

echo "<br>After:<br>";

for($x = 0; $x < $clength; $x++) {
    echo $products[$x];
    echo "<br>";
}
?>

Open in new window

Avatar of Samson Gilkinson
Samson Gilkinson

ASKER

Thanks man, I figured it out just after this but this should answer the question for others too.