Embedding php inside javascript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Embedding php inside javascript.

Is this the best way to do it? <script> Alert ( <? Php Echo "hello"; ?> ) </script>

21st Apr 2020, 12:21 PM
Franklin Rashid 🇰🇪🇲🇼
Franklin Rashid  🇰🇪🇲🇼 - avatar
2 Answers
+ 1
The best way to know is to test whether the code works. I would guess not : )
21st Apr 2020, 1:48 PM
Ipang
+ 1
Depending on the style you would love to go with.. But it feels bad and not clean that way.. Atleast if you try create a php file and use href to source out php that would help code userbillity and maintainance of the code when you are able to check the bugs where they pop up from.
21st Apr 2020, 10:26 PM
Enock Nkuya
Enock Nkuya - avatar