我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP中的动态矩阵[关闭]

I have written the PHP code below in order to create a dynamic matrix with different count of columns per row but PHPStorm says the row variable is not defined. please help.

class reply
{
    public $text;
    private $row = array(array());
    private $rowIndex = 0;
    private $colIndex = 0;

    public function Add($menu)
    {
        $this->$row[$this->rowIndex][$this->colIndex] = $menu;
        $this->colIndex++;
    }

    public function NextRow()
    {
        $this->rowIndex++;
        $this->colIndex = 0;
    }
}

$this->$row is incorrect, it should be $this->row.

近期文章

  • 每当我尝试使用此PHP脚本除txt文件下载任何内容时获取损坏的文件
  • 在localhost中执行代码时,php文件中的部分html文件不会出现
  • php分页代码不起作用
  • Daterangepicker,将数据范围传递给page.php
  • Gmail代理电子邮件中忽略了PHP参数
  • 从包括税收在内的总金额计算19%的税
  • 在CodeIgniter中的项目中遇到php错误
  • 如何获取phpFox网站的当前用户详细信息?
  • addcslashes转义大写字母
  • 用户登录时留在仪表板中
  • 我无法在php.ini中更改值upload_max_filesize
  • Codeigniter在mysql中将true插入0
  • 如何检查两个数组是否包含相同的值?
  • PDO查询返回空白数组
  • 如何使用在php中分离的键值来获取嵌套数组计数
  • PersistentCollection未初始化,但数据库中的数据使用Symfony和Doctrine
  • 在if语句中有两个foreach循环
  • Laravel(5.2)令牌在API请求上不匹配
  • 解析symfony xml配置
  • PHP拒绝接受cookie

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华