相关疑难解决方法(0)

Reference — What does this symbol mean in PHP?

What is this?

This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

Why is this?

It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …

php arguments symbols operators

4314
推荐指数
21
解决办法
63万
查看次数

PHP中的引用赋值运算符,=&

什么是=&(等于-号)赋值运算符在PHP中呢?

它被弃用了吗?

php operators assignment-operator

93
推荐指数
4
解决办法
4万
查看次数

我为什么需要"&"?

请参阅Web上有关PHP Factory Pattern的示例.

在线$kind =& Vehicle::category($wheel);,我为什么要使用&

代码:

<?php
    class Vehicle {

        function category($wheel = 0) {
            if ($wheel == 2) {
                return "Motor";
            } elseif($wheel == 4) {
                return "Car";
            }
        }
    }

    class Spec {

        var $wheel = '';

        function Spec($wheel) {
            $this->wheel = $wheel;
        }

        function name() {
            $wheel = $this->wheel;
                return Vehicle::category($wheel);
        }

        function brand() {
            $wheel = $this->wheel;
                $kind =& Vehicle::category($wheel);
            if ($kind == "Motor") {
                return array('Harley','Honda');
            } elseif($kind = "Car") …
Run Code Online (Sandbox Code Playgroud)

php oop

4
推荐指数
1
解决办法
154
查看次数

标签 统计

php ×3

operators ×2

arguments ×1

assignment-operator ×1

oop ×1

symbols ×1