Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Javascript Strings vs PHP Strings with Functions

Javascript and PHP share many similarities when writing functions; such as how the function is written:

However, there are a few fundamental differences. For one, Javascript functions can start be started by using html, while php functions tend to be called from PHP files. 

Several methods to start Javascript files are to run when the page loads using <body onload'”myfunction()”> or to call them when a form is submitted <input type=”button” value=”Submit” onclick=”myfunction()” />, or to create an anchor link <a href=”javascript:myfunction()”>Text link</a>.

With Javascript, there are many event handlers for which to start a function. Many of the popular event handlers are:
onload , onclick, onmouseover, onmouseout, onfocus, onchange, onblur and onsubmit.

PHP tends to call a function within php such as:
myfunction(); or

Other differences exist within the functions. Javascript and PHP can use similar methods to create variables in strings:
(i.e.) $myvar=”Here is a string of text”;
However, Javascript can create and use strings without ‘$’ and do not need to close the line:
myvar= “Here is a string of text”

In PHP, variables wouls always need ‘$’ to define a string.