oop - Why the Functions aren't defined ? PHP -


what have can use standard php functions without creating instance of math_functions class ?

<?php      class math_functions {          public static function evennumber($number) {             return !($number & 1);         }          public static function natual_sum($n) {             while ($n) {                 if (evennumber($n)) {                     $sum = $sum + $n;                 }                 $n--;             }             return $sum;         }      }      echo natual_sum(4); ?> 

this static function. have access using class name. use this

math_functions::natual_sum(4);  

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -