Sort a complex associative array in PHP -
this question has answer here:
- php sort array subarray value 5 answers
i have associative array in php like:
$newarray1 = array ( [producta] => array ( [link] => http://sanjosespartan.com/blog/products/agile-java-development/ [visitcount] => 4 ) [productd] => array ( [link] => http://sanjosespartan.com/blog/products/intro-to-go/ [visitcount] => 1 ) [productg] => array ( [link] => http://sanjosespartan.com/blog/products/node-js-for-developers/ [visitcount] => 1 ) [productb] => array ( [link] => http://sanjosespartan.com/blog/products/beginning-mysql/ [visitcount] => 1 ) [productc] => array ( [link] => http://sanjosespartan.com/blog/products/computer-networks/ [visitcount] => 1 ) [productf] => array ( [link] => http://sanjosespartan.com/blog/products/mongo-database/ [visitcount] => 1 ) [producth] => array ( [link] => http://sanjosespartan.com/blog/products/python/ [visitcount] => 1 ) [producti] => array ( [link] => http://sanjosespartan.com/blog/string-theory/ [visitcount] => 1 ) [productj] => array ( [link] => http://sanjosespartan.com/blog/tcs/ [visitcount] => 1 ) [producte] => array ( [link] => http://sanjosespartan.com/blog/products/java-complete-refrence/ [visitcount] => 2 ) )
now need sort entire array based on visit count. tried using arsort
did not work.
there's lot of answers this. 1 :
https://stackoverflow.com/a/16788610/4632883
look harder before posting !
PHP7 Scalar Type Declaration
ReplyDeletePHP Global Variables
Cookies in PHP
Exception Handling in PHP
Object Oriented Programming in PHP
Google Maps custom marker example