Ds\Sequence::find

Ds\Sequence::find

(PECL ds >= 1.0.0)

Ds\Sequence::find Attempts to find a value's index.

Description

abstract public mixed Ds\Sequence::find ( mixed $value )

Returns the index of the value, or FALSE if not found.

Parameters

value

The value to find.

Return Values

The index of the value, or FALSE if not found.

Note:

Values will be compared by value and by type.

Examples

Example #1 Ds\Sequence::find() example

<?php
$sequence = new \Ds\Vector(["a", 1, true]);

var_dump($sequence->find("a")); // 0
var_dump($sequence->find("b")); // false
var_dump($sequence->find("1")); // false
var_dump($sequence->find(1));   // 1
?>

The above example will output something similar to:

int(0)
bool(false)
bool(false)
int(1)

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/ds-sequence.find.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部