Home  >  Q&A  >  body text

PHP parsing error: syntax error, unexpected '

When I change from php 5.6 to php 7.4 I get this error:

PHP parsing error: syntax error, unexpected '[', expecting ';' or ',' in ./dbdrivers/odbc.php IN $$args[1]

function &db_fetch_row ($args=array()){
     global $$args[1];

     switch(count($args)) {
     case 2:
             return (odbc_fetch_into($args[0], $args[1]));
     default:
             return (odbc_fetch_array($args[0]));
     }
}

P粉183077097P粉183077097231 days ago320

reply all(1)I'll reply

  • P粉986937457

    P粉9869374572024-03-20 12:48:54

    You must specify

    ${$args[1]}

    or

    ${$args}[1]

    https://www.php.net/manual/en/language.variables.variable.php

    reply
    0
  • Cancelreply