/ Published in: PHP
                    
                                        
How to check if a number is odd or even in PHP. Could also use the MOD (%) function, but apparently this method is better performance-wise.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// Change '10' to be any number you want
<?=(10&1) ? "odd" : "even"?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                