企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 实例 ### SplMaxHelp 从大到小 ``` $obj = new SplMaxHeap(); $obj->insert( 4 ); $obj->insert( 8 ); $obj->insert( 1 ); $obj->insert( 0 ); foreach( $obj as $number ) { echo $number."\n"; } //8 //4 //1 //0 ``` ### SplMinHelp 从小到大 ``` $obj = new SplMinHeap(); $obj->insert( 4 ); $obj->insert( 8 ); $obj->insert( 1 ); $obj->insert( 0 ); foreach( $obj as $number ) { echo $number."\n"; } //0 //1 //4 //8 ```