如何在php中将值分别显示为字符串,整数和双精度

How can I display the value separate into string, integer and double in PHP using multidimensional array?

Here's my code:

<?php
$array = array(
    array ("one"=>1,"two"=>"two","three"=>3.1,"four"=>4,"five"=>"five"),
    array ("six"=>6.1,"seven"=>7,"eight"=>"eight","nine"=>9.1,"ten"=>10),
    array ("eleven"=>"eleven","twelve"=>12.1,"thirteen"=>13,"fourteen"=>"fourteen","fifteen"=>15.1),
    array ("sixteen"=>16,"seventeen"=>"seventeen","eighteen"=>18.1,"nineteen"=> 19,"twenty"=>"twenty"),
    array ("twenty-one"=>21.1,"twenty-two"=>22,"twenty-three"=>"twenty-three","twenty-four"=>24.1,"twenty-five"=>25)
);

Use two foreach statement, one to get each array and one to loop get the value and use switch/case to determine the value and according to it add this value to the array of that type

$integer=array();
$double=array();
$string=array()
foreach ($rows as $row) {
foreach($row as $key=>$value){
switch (true){
    case is_string($value):
        // string
$string[]=$value;
        break;
    case is_int($value):
        // int
$integer[]=$value;
        break;
    case is_float($value);
       // double 
$double[]=$value;
       break;
default:
}
}
}
$values=array('int'=>array(), 'double'=>array(), 'string'=>array());
foreach ($rows as $row) {
    foreach($row as $key=>$value){
        switch (true){
            case is_string($value):
                $values['string'][]=$value;
                break;
            case is_int($value):
                $values['int'][]=$value;
                break;
            case is_float($value);
                $values['double'][]=$value;
                break;
            default:
        }
    }
}