how i can to define this code into a variable?
where $random_number is a variable to call like this:PHP Code:srand ((double) microtime( )*1000000);
$random_number = rand( );
<b>$random_number</b>
how i can to define this code into a variable?
where $random_number is a variable to call like this:PHP Code:srand ((double) microtime( )*1000000);
$random_number = rand( );
<b>$random_number</b>
I don't understand you. "Define this code into a variable?" You mean you want to create a function? And the way you use that variable - short of a here-document - is never going to work. You want:Code:<b><?php echo($random_number); ?></b>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I need to create this code in a so called variable <module:randomnumber> for then to be able to integrate with javascript. regards
example:
HTML Code:<SCRIPT>ppreview('http://www.google.com','<module:randomnumber>')</SCRIPT> <SCRIPT>potherfunctions('http://www.google.com','<module:randomnumber>', '')</SCRIPT>
PHP and Javascript work at very different levels to one another, and the only way to pass a variable from PHP to Javascript is to echo it straight into the Javascript code.Code:<SCRIPT>ppreview('http://www.google.com','<?php echo($random_number); ?>')</SCRIPT> <SCRIPT>potherfunctions('http://www.google.com','<?php echo($random_number); ?>', '')</SCRIPT>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks