Thursday 21 December 2017

sort array on specific value with php

I have an array with specific values in it and i would
like to sort the array on a specific value in it. For instance, TOTCOM_METIER
DESC.
Ex
:



Array
(

[0]
=> Array
(
[TOTCOM_METIER] => 1
[metier] =>
Traiteur
)

[1] => Array
(

[TOTCOM_METIER] => 4
[metier] => Restauration
traditionnelle

)

[2] => Array

(
[TOTCOM_METIER] => 2
[metier] => Coiffure

)

)



I
would like to sort it on TOTCOM_METIER DESC to have this result
:



Array
(
[0]
=> Array
(
[TOTCOM_METIER] => 4
[metier] =>
Restauration traditionnelle
)


[1] =>
Array
(
[TOTCOM_METIER] => 2
[metier] =>
Coiffure
)

[2] => Array
(

[TOTCOM_METIER] => 1

[metier] => Traiteur

)

)

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...