background preloader


Facebook Twitter

Better Understanding PHP’s Garbage Collection. It’s interesting how just a few years can make a difference in the names that are given to things.

Better Understanding PHP’s Garbage Collection

If this were to come up today, it would probably be called PHP Recycling Options, because rather than picking things up and throwing them into a landfill where they’ll never be seen again, we are really talking about grabbing things whose use has passed and setting them up to be useful again. But, recycling wasn’t le petit Cherie of society back when the idea was developed and so this task was given the vulgar name of ‘Garbage Collection’. What can we do but follow what history and common usage have given us? Program Generated Garbage Programs use resources; sometimes small ones, sometimes much bigger. When the program ends, naturally, the program, and any space that it has tied up, will disappear and the total space available will expand back to it’s maximum size.

I’ve written a few of these such programs in my time. First Level – End of Scope Second Level – Reference Counting. FPDF. 30+ PHP Best Practices for Beginners. Why is it better to develop in PHP with classes (OOP)? - PHP Classes blog. Introduction What are Object Oriented Programming Classes? Why it is better to develop your PHP projects using OOP classes? When OOP Classes are not really necessary? How do I migrate my global code to use OOP classes? Conclusion Until recently I thought that articles like this were not necessary because I assumed that the basic concepts about Object Oriented Programming are well known and understood by most PHP programmers.

However, after repling to a question that appeared in the Quora site on how to go from procedural to object-oriented PHP , I reflected a bit and realized that a great part of the PHP developers do not have basic knowledge Object Oriented Programming (OOP), or if they know what that it is, they do not see much point in using it, so they do not take advantage of OOP benefits in their projects. Here are are few evidences of the problem: a) Once in a while I read people ranting about the use of Object Oriented Programming. Having global code in a project is not a sin. 1. 2. PHP Class Scripts, PHP Tutorials, PHP Book Reviews, PHP Jobs, PHP Professionals, PHP User Groups, PHP Forums, Web hosting comparisons. Problem sending mail with PHP mail function. Occasionally I have had trouble sending emails using the builtin mail() function in PHP.

Problem sending mail with PHP mail function

Sometimes emails never reached their intended destination. Naturally I have assumed that there might be a problem with some spam filters used. However, lazy as I am, I have not given it a second thought. Instead I have used a PHP class that allows me to send emails using a remote smtp server using an account on that dedicated server. This has been a good solution for my setup anyways. The problem seems to be that PHP use the ini directive sendmail_from to set the from email address in the SMTP protocol. The simplest solution is to set the directive during execution: ini_set("sendmail_from", $email_from); $headers = "From: $email_from";mail($to, $subject, $message, $headers); The problem as well as the solution was already known by others.

Still I bet there are lots of people out there with this problem without them knowing it. PHP: Reloading Your php.ini File with IIS 6 Manager. Main Page - Computer Science S-75. Try PHP in your browser -