- PHP 手册
- 函数参考
- 其它基本扩展
- SPL
- 各种类及接口
- ArrayObject
ArrayObject::getFlags
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ArrayObject::getFlags — Gets the behavior flags
说明
public ArrayObject::getFlags(): intGets the behavior flags of the ArrayObject. See the ArrayObject::setFlags method for a list of the available flags.
参数
此函数没有参数。
返回值
Returns the behavior flags of the ArrayObject.
范例
示例 #1 ArrayObject::getFlags() example
<?php
// Array of available fruits
$fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
$fruitsArrayObject = new ArrayObject($fruits);
// Get the current flags
$flags = $fruitsArrayObject->getFlags();
var_dump($flags);
// Set new flags
$fruitsArrayObject->setFlags(ArrayObject::ARRAY_AS_PROPS);
// Get the new flags
$flags = $fruitsArrayObject->getFlags();
var_dump($flags);
?>
以上例程会输出:
int(0) int(2)
参见
- ArrayObject::setFlags() - Sets the behavior flags
User Contributed Notes
There are no user contributed notes for this page.官方地址:https://www.php.net/manual/en/arrayobject.getflags.php