Dynamic PHP - Tricks PHP can do that Java/C#/C++ wont

Creating dynamic classes that change themselves at run time and creating new methods and member variables on the fly. You can’t do that with the Java, C++, or C# languages.

read more | digg story

2 Responses to “Dynamic PHP - Tricks PHP can do that Java/C#/C++ wont”

  1. Leonid Mamchenkov Says:

    You can’t do that with the Java, C , or C# languages.

    However, if you need to do this sort of things, than use Perl. It does that (and more) better.

  2. PvUtrix Says:

    Define better… faster? easier? simpler? more elegant?

    Most people seem to agree that knowing both is a definite plus, while Perl is more flexible and complete PHP is more simple, easier to install and fast.

    Have a look at this for more oppinions

    Did you know that PHP5 has a perl extension? :)

    // example 1
    <?php

    print “Hello from PHP!\n”;
    $perl = new Perl();
    $perl->eval(’print “Hello from Perl!\n”‘);
    print “Bye!\n”;

    ?>

    // example 2
    <?php

    $perl = new Perl();
    $perl->eval(’
    sub sum {
    my $x = shift(@_);
    foreach my $y (@_) {
    $x = $y;
    }
    return $x;
    }
    ‘);

    print $perl->eval(”sum(1, 2, 3, 4, 5, 6, 7, 8, 9)”).”\n”;
    print $perl->sum(1, 2, 3, 4, 5, 6, 7, 8, 9).”\n”;

    ?>

Leave a Reply