While you can pass a PHP array to a JavaScript function, can you pass the opposite? (a JavaScript function into an PHP array).
Consider this code. I want to call a JavaScript timer inside a PHP array, as the array later randomizes messages for an echo.
$messages = array('How are you today?', 'Perfect day for flying, isnt it?', 'You have flown last on '.$lastflown.'.', 'The time is /* insert the JavaScript function to call a timer here */');
$key = array_rand($messages);
And of course I want to display the message:
<?php echo $messages[$key]; ?>
Is this possible? If not, how can this be bypassed? Perhaps a JavaScript randomizer instead?