php key() function
Translation results:
UK[ki:] US[ki]
n.Key; (of a typewriter, etc.) key; key, clue, secret; (of music) key
vt.Type; Lock; adjust the tone of...; provide clues
vi. Use keys
adj. Critical; main
Third person singular: keys Plural: keys Present participle: keying past tense: keyed past participle: keyed
php key() functionsyntax
Function: Returns the key name of the element currently pointed to by the internal pointer of the array.
Syntax: key(array)
Parameters:
Parameter | Description |
array | Required. Specifies the array to use. |
Description: Returns the key name of the element currently pointed to by the internal pointer of the array. If an error occurs, the function returns FALSE.
php key() functionexample
<?php $people = array("西门", "灭绝", "无忌"); echo "键的当前位置是:" . key($people); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
键的当前位置是:0
<?php $arr = array("西门", "灭绝", "无忌"); $arr2 = next($arr); //指向下一个元素 灭绝 echo key($arr); //输出灭绝的 key值 ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
1
Popular Recommendations
- Lerna – The key of Monorepo Management
- TypeScript vs JavaScript: Key Differences for Developers
- Secure API Key Handling in Python Projects
- Bitcoin (BTC) Nears Resistance: Key Levels to Watch
- SOAP vs REST API: Understanding the Key Differences
- Dogecoin Faces Key Resistance at $0.10 Amid Market Anticipation