Javascript | PHP |
<script language="javascript"> | <? php |
var a = "codes"; var b = "codes"; | $a = "codes"; $b = "codes"; |
with(document){ write (a+b); | echo $a, $b; |
}</script> | ?> |
NOTES ON PHP: You can use the tags <script language="php"> and </script>. It works fine when embedded in a html page. If you use the shortcut code however, the <?php, make certain that there is no space between the question mark and the word php, or you will get an error. Each ($) variable should begin on a new line and must be within quotes and end with a semicolon. Each echo call to a string of variables must begin on a new line. It does not seem to matter if there are spaces after the comma between echo'd string of $variable names. Again a semicolon is required at the end of each echo line. The file name should end with the extension php such as filename.php |
ERROR CODES: These notes are spotty because this art is new and I do not really know what kind of problems can occur. I do know that if you leave out a semicolon, comma, or add a bracket or something that it does not recognize, you will get an error message. It may say something like, Parse error, unexpected T variable on line 7. In this case you will have to go back in to the file to correct the error. |
A fatal error can occur also, and depending on your server, either nothing will seem to happen or you will get a message saying that it is a kind of information that can't be used. You can contact your server administration about your server's handling of error messages. In either case, if this happens, correct the error, and then you must change the filename to clear the cache. So it might be a good idea to give it a temporary name to begin with. Then when you have completed your table art, give it its permanent name. |
Because PHP byte budget is very similar to javascript byte budget, I have done these tables first in javascript and then transfomed the same code to php to show the similarities in coding. The $name = "codes"; is called a string. If you are not familiar with Byte budget in coding and do not have access to a php server, please check these two sites for more information. jawjahboy.com and Javascript Jungle You can also learn more about php using the GD library by going to another one of Sally's sites at PHP/GD |
Here are 3 gradtables with a link to the Javascript and PHP codes. This is done to show the various ways of using one script by modifying it as you choose to create another image, and then combining them on a page. |
JS AND PHP BYTE CODES |