Fatal error Function name must be a string

thanks to the people who answered my last question

I keep getting this error: the function name should be a line in /home/pulsergf/public_html/these/vars.php on line 4

<?
$array = array('555', '666', 'aaa', 'bbb', '777', '888');
$rand_index = mt_rand(0, count($array) / 2 - 1) * 2;
$define('BOUGHT','echo "$array[$rand_index]";');
$define('SOLD','echo "$array[$rand_index+1]";');
?>

so he needs to select a pair in the array for BOUGHT and SOLD, but I keep getting this error. thank

+2
source share
2 answers

use defineinstead$define

$define()indicates a variable to a function , which means that it takes a string value $defineand tries to call a function with the same name as this string.

+1
source

You do not need $to define.

Why?

define $, (...), function. $define , .

+1

Source: https://habr.com/ru/post/1789162/