3D Rendering in PHP
Found this nice article on 3D Rendering in PHP on digg.
Really Cool 3D Rendering with PHP (digg)
PHP “raycaster” 3D renderer
Posted by Usman Ilyas.
Found this nice article on 3D Rendering in PHP on digg.
Really Cool 3D Rendering with PHP (digg)
PHP “raycaster” 3D renderer
Posted by Usman Ilyas.
If you’re migrating from ASP to PHP, you might consider using ASP2PHP, a freeware converter between the languages. Although it isn’t perfect, it can give you a big head start if you are trying to migrate a large project. Your best option is to use the tool, then go over the generated scripts by hand to make sure there are no bugs or performance issues. You can download ASP2PHP from http://asp2php.naken.cc.
PHP uses a blend of interpretation and compilation in order to provide the best mix of performance and flexibility to programmers.
Behind the scenes, PHP compiles your script down to a series of instructions (called opcodes) whenever it is accessed. These instructions are then executed one by one until the script terminates. This is different from conventional compiled languages such as C++ where the code is compiled down to native executable code then that executable is run from then on. Instead, PHP re-compiles your script each time it is requested.
This constant recompilation may seem a waste of processor time, but it is actually not all that bad because you no longer need to worry about hand recompiling your scripts when you make any changes. On the flip side, many scripts take longer to compile than they do to execute!
Furthermore, it provides very quick feedback during development. If you have an error somewhere in your file, PHP will refuse to compile the page until you have fixed the problem, and you are able to step through execution of your code line by line until you find the problem.
The speed hit of regular compilation is nullified entirely by the use of PHP accelerators.
One major advantage to having interpreted code is that all memory used by the script is managed by PHP, and the language automatically cleans up after every script has finished. This means that you do not need to worry about closing database links, freeing memory assigned to images, and so on, because PHP will do it for you. That is not to say you should be lazy and make PHP do all the work - good programmers clean up themselves, and let PHP work as backup in case something is missed.
For all those who are just learning php, or even for those who already know php, or and other web language, or programing language for that matter, here are a few good tips on what makes a good script.
Simplicity
Does your script (or program) have too many excess lines of code? have you looked for ways to trim it down? Getting rid of excess code can speed up your script, which in the long run can have good benifits. Below is a example of how you could trim down your script.
Sanario: You need more than 1 thing to match something before something is executed. Code:
if ($i == '1') {
if ($x == ‘2′) {
echo (’i equals 1 and x equals 2′);
}
}
Trim it down like this:
if ($i == '1') && ($x == '0') {
echo (’i equals 1 and x equals 2′);
}
Just simple things like that can be a big benifit in the long run. As well as script loading times, it is also easy to edit. Though that is for the next step.
Errors
How easy is it to find errors in your script. If it is a long script, and it is the first time you run it, you are bound to have 1 or more errors in it. SOme things that I reccomend it that you slowy add things to the script, see if it works, and if it does, keep adding things. Though if there is a error, you know exactly what you have just done and it will be much easier to track down. Though if you have been editing a long script and can’t do that, how easy is the script to read? I talked about this is the last step. Try to make it easy for you and other programers to read so in the future. This can make like allot easier for you.
Making
Do you know what you are actually making in your script? Lets take a random script for example. I know what the end is going to be, though do i have a vaig idea what the script is going to be made up of? Well, I just have to think and write down a few things before attempting to write the script. So, I want to put everything into a array and select a random entry out of the array. Easy. Now you know how the script is going to work you can start working on it. I have attempted to make a sudoku puzzle solver, and it was really hard. I knew what the end was going to be, though when I went to start scripting, I had no idea what to write down.
Audience
Who is the script or program going to be aimed at. If it is aimed at a webmaster or computer technitican, you don’t have to make it as easy to use as if you were making it for someone who is a complete n00b at computers. A nice simple interface is the best. Only include the essencial controls. Extra controls can have a seperate page for those who are daring enough to look at them. Simple = Good!
Just remember these few steps and you will be on your way to a better script!
Posted by Josh.
Do you want to learn PHP? I did. And Trust me, it isn’t the easiest thinig that I have ever done. Only want to learn a few things so you know the basic synax and can more of understand things when installing a script? Well, below are a few links that I think you should look at. One of the best of them all is the manual from php.net (suprise suprise. That is the one I read :D), though some are just for people that want to learn a few basics or people who read the first few chapters of the php manual and didn’t understand it.
PHP Manual — http://www.php.net/manual/en/
w3schools — http://www.w3schools.com/php/default.asp
PHP5 for Beginners — http://www.dinkumsoft.com/dsd/ebooks/php54b.html $ alert =(
Posted by Josh.
Even though we should have our posts on a bit of ice until everything is settled down I just had to show you all php coders this nifty tool for Konfabulator. The PHP Search tool is made by Andrew Moore, and…
…search for a PHP function and this Widget will open the corresponding reference page for you!
You need Konfabulator to use this program. But luckily Yahoo bought up the company and is now giving away this cool program completely free! You can read more about it here.
You are currently browsing the archives for the PHP category.