-2
$row['test']='this is test index';
$test="$row['test']";
echo $test;

in the above code in variable test I want to store name of the varible $row['test'] and then try to print test. The desired output should be 'this is test index' but the output I am getting is Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) . So my question is how can I actually get the value of variable $row['test'] stored in the variable test as string.

zeeeuu
  • 19
  • 4
  • 2
    Just `$test = $row['test'];`. This is extremely basic PHP by the way, you should probably read the [manual on strings](http://php.net/manual/en/language.types.string.php). – Jeto Feb 03 '19 at 11:10

1 Answers1

1

Just Remove the double quotations from "$row['test']" This is works

    <?php
    $row['test']='this is test index';
    $test=$row['test'];
    echo $test;
    ?>