What am I doing wrong
I have this script, and added the $randnumber = rand(100, 500); function to it, this should generate a random number for me between 100 and 500.
$randnumber = rand(100, 500);
function word_limiter( $text, $limit = $randnumber, $chars = '0123456789' )
The problem is that it gives me a error:
Parse error: syntax error, unexpected
T_VARIABLE
While if I use the function as:
function word_limiter( $text, $limit = '200', $chars = '0123456789' )
it works 100%, I have tried it like this:
function word_limiter( $text, $limit = ''.$randnumber.'', $chars = '0123456789' )
but still get an error?
That is a syntax error. You cannot assign the value of an expression as a default value. Default values can only be constants. Instead of doing that, you could be doing something like: