小编S P*_*S P的帖子

create_function而不是lambda-function avartaco

我试图实施avartaco,就像gravatar一样.

为了使它在php版本<5.3中工作

如果你想让它在低于5.3.0的PHP上工作,找到字符串

array_walk($ shape,function(&$ coord,$ index,$ mult){$ coord*= $ mult;},self :: SPRITE_SIZE);

并使用create_function()而不是lambda-function重写它.

我收到了错误 Parse error: syntax error, unexpected T_FUNCTION在同一行array_walk中. php版本是5.2.17 <5.3但是我不知道createfunction的重写是什么意思?

那么我应该在该行中进行哪些更改以使其在php版本<5.3中工作

私有函数GetShape($ type){

    switch($type) {

        case 'side':

            $shape_id = hexdec(substr($this->_hash, 22, 1)) & (sizeof($this->_shapesSide) - 1);

            $shapes = $this->_shapesSide;
        break;
        case 'center':
            $shape_id = hexdec(substr($this->_hash, 23, 1)) & (sizeof($this->_shapesCenter) - 1);

            $shapes = $this->_shapesCenter;
        break;

        case 'corner':
            $shape_id = hexdec(substr($this->_hash, 24, 1)) & (sizeof($this->_shapesCorner) - 1);

            $shapes = $this->_shapesCorner;
        default:
        break;

    }

    $shape = …
Run Code Online (Sandbox Code Playgroud)

php

7
推荐指数
2
解决办法
194
查看次数

标签 统计

php ×1