This is a mistake in the Parse error code: syntax error, unexpected '['



  • That's mistake in the code:

    Parse error: syntax error, unexpected '[' in /home/reffe318/public_html/prote cted/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 426

    I can't decide. Help!

    Here's the code where the mistake is:

    function class_uses_recursive($class)
    {
        $results =[];
        foreach (array_merge([$class => $class]), class_parents($class)) as $class) {
            $results += trait_uses_recursive($class);
        }
    
    return array_unique($results);
    

    }

    Place indicated by error:

    $results =[];

    after correction

    $results = array();
    foreach (array_merge(($class => $class)), class_parents($class)) as $class)
    {
    $results += trait_uses_recursive($class);
    }

    return array_unique($results);

    syntax error, unexpected T_DOUBLE_ARROW on line 427

    I think.
    foreach (array_merge($class = $stateclass)

    after correction

    $results = array();
    foreach array_merge(array($class => $class), class_parents($class))



  • You're probably updated. Laravel♪ With the version v5.1.0 This fraimvor needs php: >=5.5.9♪ Or turn the project on the new server with the old one. php

    Option 1

    Update. PHP short recording of masses [1,2,3] It's just... php >= 5.4♪ You can check the version in the consoles by dialing php -vbut it's best to use the web server, since the OSS interpreters can be a few. Create the file and open it in the browser with the following contents:

    <?php
    phpinfo();
    

    And watch the story.

    введите сюда описание изображения

    Option 2

    From the directory vendor You're using a composer and you can easily roll the version. Laravel♪ Just point it out. composer.json supporting version php 5.4:

    "require":{
        ...
        "laravel/framework":"5.0.*"
        ...
    }
    

    If there's different websites on the server with one web server, it's best to roll off the braid, or if there's a good admin in hand, there's different versions. php For different virtual hosts to build. Other cases better update php

    PS

    You were so pissed with a piece of code I couldn't handle. Here's the right code under 5.4:

    function class_uses_recursive($class)
    {
        $results = array();
        foreach (array_merge(array($class => $class), class_parents($class)) as $class) {
            $results += trait_uses_recursive($class);
        }
    
    return array_unique($results);
    

    }


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2