Hello. I start" programing" in p5 few weeks ago. Last week try figure out one problem by reading refference , look tons from YT, and searching at forums.
end of file
I just want to know , HOW send variables(and values) from php to p5 , and second direction…
I was try evheryting. define by let, var. Using clear js make error.
I train defining on start file, in setup function , and draw.
Ofcourse js is glued in php, and syntax is correct.
In my dreams i see now only big bloody:" Empty and NO DEFINE" :).
$ble = 7
$ble2 = 'hello'
var x = <?php echo $ble?>
console.log(x) // prints 7
var y = "<?php echo $ble2?>" // notice the quotation marks here
console.log(y) // prints hello
If you need to pass a string instead of a number, you need to put quotes.
Check this tutorial
you need to run this .php file by a server or localhost.
SyntaxError: expected expression, got ‘<’
I need share this var to js file. Scripts tags in php file is not solution. And left the second way. From js to php…
with quotes i see all what is in quotes. not values from php .
But thanks for trying and link. Morning i will read this chapter.