Profile
Achievement
                    
    
                mthorn's Recent PHP Snippets
 « Prev 1 Next »
Took 0.164692 seconds for array[]
Took 0.395778 seconds for array_push
As you can see array_push is more than twice as slow. Here are the reasons. Array_push is a function call, Function calls are always slower. Array_push takes mixed parameters,...
        
        
        
            0 
        
        
            4560 
        
                    posted 19 years ago by mthorn
            strcmp with matching strings took 0.207852 seconds
strcmp with non-matching strings took 0.215276 seconds
=== with matching strings took 0.067122 seconds
=== with non-matching strings took 0.057305 seconds
=== is the clear winner. Function call...
        
        
        
            0 
        
        
            3214 
        
                    posted 19 years ago by mthorn
            Since PHP is typeless odd things can happen when a variable is not the type you expected. PHP treats 0, null, '0', false, and '' as false. Sometimes you really want to know if the value is false. The solution is simple, use the triple equal (===) ope...
        
        
        
            0 
        
        
            1510 
        
                    posted 19 years ago by mthorn
            Often PHP can't interpret POST data because it is not form-encoded. This is typical when the post data is XML from API's like Flash's XmlSocket. You can use the following methods to read the POST data directly.
        
        
        
            1 
        
        
            2456 
        
                    posted 19 years ago by mthorn
            Will create a thumnail no taller or wider than the supplied size. Also contains some tips for reading and writing images using GD.
        
        
        
            22 
        
        
            16368 
        
                    posted 19 years ago by mthorn