Sort the array of characters in the array: PHP

If you want to select an array in the array to retrieve data from a particular variable and sorted you can use the following as an example:
 
<?php

$f = array(
            array(‘Name’ =>’Ucup’, 
                  ‘Class’ => 7),
            array(‘Name’ => ‘Faizal’,
                  ‘Class’ => 9),
            array(‘Name’ => ‘Abdul’,
                  ‘Class’ => 8)
            );

function sort($r,$d)
{
    return strnatcmp($r[‘Name’],$d[‘Name’]);
}

usort($f,’sort’);
foreach($f as $k=>$v)

    echo $v[‘Name’];
}

?>

 
On the listing coding above are arrays in the array contains variables and class name with a certain value, the first array contains the name of the class ucup and 7, both faizal and 9th grade, third grade 8. The name Abdul 

function sequence {return strnatcmp}; // useful to sort the array of characters in the array ($ r $ d); 
foreach ($ f as $ k => $ v); // $ f is the name of an array of data and then split $ k and $ v variable. 
echo $ v [ ‘name’]; // display the variable ($ v) the contents of the value of ‘name’; 

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous post Studying Writing Javascript in HTML
Next post What are the functions and procedures in Python