php版数据算法视频 php数据统计( 二 )


1
||
$key
3)
return
false;
$this-_data[$key
-
1]
=
$val;
return
true;
}
//
是否按升序排序
public
function
isAscending()
{
return
($this-_data[0]
=
$this-_data[1])
($this-_data[1]
=
$this-_data[2]);
}
//
是否按降序排序
public
function
isDescending()
{
return
($this-_data[0]
=
$this-_data[1])
($this-_data[1]
=
$this-_data[2]);
}
//
获取最大值
public
function
max()
{
return
($this-_data[0]
=
$this-_data[1])?
($this-_data[0]
=
$this-_data[2])?
$this-_data[0]
:
$this-_data[2]
:
($this-_data[1]
=
$this-_data[2])?
$this-_data[1]
:
$this-_data[2];
}
//
获取最小值
public
function
min()
{
return
($this-_data[0]
=
$this-_data[1])?
($this-_data[0]
=
$this-_data[2])?
$this-_data[0]
:
$this-_data[2]
:
($this-_data[1]
=
$this-_data[2])?
$this-_data[1]
:
$this-_data[2];
}
}
//
$objTriplet
=
new
Triplet();
echo
"init:";var_dump($objTriplet-init(1,2,3));
echo
"br/";
echo
"get
1:";var_dump($objTriplet-get(1));
echo
"br/";
echo
"get
4:";var_dump($objTriplet-get(4));
echo
"br/";
//
false
echo
"put
3,4:";var_dump($objTriplet-put(3,4));
echo
"br/";
echo
"max:";var_dump($objTriplet-max());
echo
"br/";
echo
"min:";var_dump($objTriplet-min());
echo
"br/";
echo
"isAscending:";var_dump($objTriplet-isAscending());
echo
"br/";
echo
"isDescending:";var_dump($objTriplet-isDescending());
echo
"br/";
?
php版数据算法视频的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于php数据统计、php版数据算法视频的信息别忘了在本站进行查找喔 。

推荐阅读