Kesavan Muthuvel's Personal Home Page

Index| Bookmarks| I'm supporting| More info? (About me!)| Royal Thunderbird!| Maemo N900| Nexus & Pixel (Android + more )| KODI [aka] XBMC | My Public Key (GPG) | My Sign| Travel Snaps| Blog
Thanks to..| Open Materials| interview qns| scripts to look| eBooks Collection| Web Dev tips
Looking for a girl| A day - a cartoon| Shameless self promo| Goodbye GMail
தமிழ்: Type தமிழ் | Sorry, pythagoras! | Thirukkural - #PIEM
Tools: What's your IP| Resize your image| Dark status from Tor| Random token gen| RegEx me!
Double trouble: Wed Lock - 2014| Wedlock Invitation| Thulasi Kesavan| Kundavai Kesavan

Scripts I like

Here are some scripts which are useful for preparations in PHP / MySQL .Please run these.Don't just read this. Thanks to highlight_file() of PHP.

PHP Info | echo Vs print | PHP MCRYPT | PHP FUNCTION(?) | PHP __wakeup() | PHP Date Calc | PHP Multi file attach MAIL | MySQL Date Calc | PHP OOPs | jQuery

OOPs polymorphism Method Overloading | OOPs Abstract Vs Interface | OOPs Interface

__call()  is triggered when invoking inaccessible methods in an object context.
__callStatic() is triggered when invoking inaccessible methods in a static context.
The $name argument is the name of the method being called. The $arguments argument is an enumerated array containing the parameters passed to the $name'ed method. 

More :http://php.net/manual/en/language.oop5.overloading.php

<?php
class math {

    function 
__call($name$arg) {
        switch (
$name) {
            case 
'add':
                    if(
count($arg)==2) return $arg[0] + $arg[1]; 
                    else if (
count($arg)==3) return $arg[0] + $arg[1] + $arg[2]; 
                    else if (
count($arg)==4) return $arg[0] + $arg[1] + $arg[2]+ $arg[3];  
                    else if (
count($arg)==5) return $arg[0] + $arg[1]+ $arg[2]+ $arg[3]+ $arg[4];  
                    else if (
count($arg)==6) return $arg[0] + $arg[1]+ $arg[2]+ $arg[3]+ $arg[4]+ $arg[5] ;
                    else return 
"Too longgg..."; break; 
            case 
'sub':
                    return 
$arg[0] - $arg[1]; break;
            case 
'div':
                    return 
$arg[0] / $arg[1]; break;
        }
    }

}

$calculator = new math;
echo 
$calculator->add(2,3);            echo "<br>";    #5
echo $calculator->add(2,3,4);          echo "<br>";    #9
echo $calculator->add(2,3,4,5);        echo "<br>";    #14
echo $calculator->add(2,3,4,5,6);      echo "<br>";    #20
echo $calculator->add(2,3,4,5,6,7);    echo "<br>";    #27
?>


Return to Kesavan Muthuvel's home page.

Please send comments on these web pages to hi@kesavan.info (or)  Feedback here

CopyLeft (Ͻ) 2008 - 2023 Kesavan Muthuvel More on CopyLeft

I Don't Love FaceBook