由sql数组得到的echo max值

时间:2013-01-16 20:25:43

标签: php

我得到了以下数组

Array (
    [G_ID] => 11
    [Username] => student
    [Password] => admin
    [gender] => m
    [email] => dsfsdas
    [phone] => hgjhg
    [address] => surat
    [birthdate] => 
    [interest] => 
    [goal] => 
    [User_Type] => student
    [Conform] => 1
    [l_name] => student
    [f_name] => student
    [clg_name] => scatt
    [branch] => cseq
    [avatar] => 11avatarJaguar_Logo.jpg
    [Student_Master_ID] => 11
    [Staff_Master_ID_Staff_Master] => 
    [Branch] => cseq
    [Semester] => 8
    [PEN] => 090490131013
    [SPI_1] => 6.50
    [SPI_2] => 5.20
    [SPI_3] => 7.5
    [SPI_4] => 6.5
    [SPI_5] => 8.0
    [SPI_6] => 7.1
    [SPI_7] => 8.0
    [SPI_8] => 0
    [0] => 6.50
    [max(SPI_1)] => 6.50
    [1] => 8.0
    [max(SPI_2)] => 8.0
    [2] => 7.5
    [max(SPI_3)] => 7.5
    [3] => 6.5
    [max(SPI_4)] => 6.5
    [4] => 8.0
    [max(SPI_5)] => 8.0
    [5] => 7.1
    [max(SPI_6)] => 7.1
    [6] => 8.0
    [max(SPI_7)] => 8.0
    [7] => 0
    [max(SPI_8)] => 0
) 

我想打印此max(SPI_1)值。如何打印此值?

2 个答案:

答案 0 :(得分:4)

您应该阅读arrays

//    key     => value
// max(SPI_1) => 6.50

有了这些知识,你就会这样做:

echo $student["max(SPI_1)"];

答案 1 :(得分:1)

假设数组存储为$array

echo $array['max(SPI_1)'];

这不起作用吗?