PHP code example of techdivision / lang

1. Go to this page and download the library: Download techdivision/lang library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

techdivision / lang example snippets


// initialize a new Integer instance
$bool = new Boolean(true);
$bool->equals(new Boolean(false)); // false

// throws a ClassCastException
$invalid = new Boolean('aValue');

// initialize a new Integer instance
$int = new Integer(17);
	    
// get the float value of the Integer
echo $int->floatValue() . PHP_EOL; // 17.0
echo $int->stringValue() . PHP_EOL; // '17'

// check that the two Integer instances are equal
$int->equals(Integer::valueOf(new String('17'))); // true

// initialize a new Float instance
$float = new Float(10.005);
$float->add(new Float(10.105));
        
// check the value
echo $float->floatValue() . PHP_EOL; // 20.11

// initialize a new String instance
$string = new String('value to');
		
// check that String was successfully concatenated
echo $string->concat(new String(' search')) . PHP_EOL; // 'value to search'