How to run php in javascript

   Topics with a title like this, I’m  often found on forums for programmer.
And of course the beginners in web development is most interested in this.
   We all studied, and the best step is to ask a professional about it,
although on the forums in the Rf, the answer is given, after insults
of the topic starter.
PHP runs inside JS, and does it successfully, which is very often I used in my practice.
Here is PHP and JS code example , probably the most relevant.
First we have PHP inside HTML,
then JavaScript inside PHP,
And PHP variables inside js with concatenation operator.
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body> // htmk code
<?php 
// php starts here
echo' 
// here inside php we have html and php variables combined by concatenation operator "." - the dot.
						 <div class="uroven"> <h5>Some Title'.$arrayLevels[$row['e_level']].'

						 </div><div class="koordinator">Coordinator: 
// and here is javascript inside php code
								<script type="text/javascript">
												var b = "'.$arrayInvol['einfo']['creator'].'";
// and above we have a php dataset - "$ arrayInvol" inside js

												switch (b) {
												  case "B.Wein":
												    document.write("B.Wein 99 000 00 01");
												    break;
												  case "C.Kent":                    
												    document.write("C.Kent 99 000 00 02");
												    break;
 default:
												    document.write("P.Parker 911");
												}
												</script>'; ?>
</body>
</html>
I hope everyone understood this, I tried to show the interaction of these programming languages with a very simple script as clearly as possible.
Leave your questions and suggestions in the comments.
Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *