Thursday, February 15, 2007

PHP code

I have heard from several developers that they hate PHP, but I have to admit that every time I need example code to help me do something the PHP documentation has never let me down. Why is that? The PHP documentation allows user comments, just like a blog and the comments are displayed at the bottom of every PHP command. For instance, I needed to find a way to read an MP3 file MP3 files and return it to any browser to allow the user to save the file to their computer. Sounds easy, but it turns out the code is quite complex. I searched google for "read MP3 PHP" and found sample code that did not work, and then saw one line at the bottom of the sample that used a PHP function I had not heard of before called "fpassthru". When I went to PHP fpassthru, I learned that using fpassthru is actually much slower than feof and fread. The code I am using was taken from the post named file downloads verified by session vars : 22-Oct-2005 03:36.

No comments: