in java you do:
public class Test
{
public static final int MODE_READ = 0;
public static final int MODE_WRITE = 1;
public static doSomething( int mode )
{
// do something with the mode
}
}
System.out.println( "(int) mode is:" + Test.MODE_READ );
is there a way have the same in PHP? without instantiating a class? Or do i have to wait until PHP 5? My PHP version of the code above is somehow ugly and unsatisfying 🙁
define( 'TEST_MODE_READ', 0 );
define( 'TEST_MODE_WRITE', 1 );
class Test
{
function doSomething( $mode )
{
// do something with the mode
}
}
echo "(int) mode is:" + TEST_MODE_READ;