function get( $str ){
$matches = $this->xml->xpath("/conf/item [@name= \"$str\"]");
if (count($matches)) {
$this->lastmatch = $matches[0];
return (string) $matches[0];
}我找不到这段代码的最后一行的任何信息。
这个(字符串) $matches片段是做什么的?
正如我所猜测的,它以字符串的形式返回数组的零元素。但我在文档中没有发现任何关于这个语法的地方。
我说的对吗?
如果你能给我提供一个链接,我可以在这里读到这方面的信息,那将是非常棒的。
发布于 2016-04-12 11:29:26
你可以在这里读到:http://php.net/manual/en/language.types.type-juggling.php
它被称为类型杂耍,因为php没有显式类型。
您可以使用下列类型的铸件:
(int),(整数)-转换为整数 (bool),(Bool)-转换为bool (浮动),(双),(真实) (字符串)-转换为字符串 (数组)-转换为数组 (对象)-转换为对象 (unset) -强制转换为空(PHP 5)
https://stackoverflow.com/questions/36571889
复制相似问题