0

I have a game built in PHP and javascript that allows users to spin a bottle around a circular board. I'm including a snippet of code from the php file that interprets the rewards users get when landing on a certain section. I'm trying to edit the '5 points' message part and change it so that it awards a random number of points between 1 and 50. This is more of a syntax thing, because I tried putting in

45 => array(
    'message' => '5 Points',
    'callback' => array('point_add', array rand(1,50))
),

but that didn't work. What is the correct syntax?

SpinBubble::$rewards = array(
0 => array(
    'message' => 'MINI Cooper Sweepstakes Entry',
    'callback' => array('sweepstakes_entry', array('cooper'))
),
15 => array(
    'message' => 'Spin Again',
    'callback' => array('credit_add', array(1))
),
30 => array(
    'message' => 'Designated Driver',
),
45 => array(
    'message' => '5 Points',
    'callback' => array('point_add', array(5))
),

1 Answer 1

1

Try this

45 => array(
    'message' => '5 Points',
    'callback' => array('point_add', array(mt_rand(1, 50)))
),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.