PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php //Given this: $foo = array(1, 3, 7); //write a function (on this whiteboard) to sum the values of the array. //$sum = 0; //for($i=0; $i < count($foo); $i++){ // $sum += $foo[$i]; //} //echo($sum); //echo(array_sum($foo)); //Given this: $text = 'Pick first and two last chars'; //write a function (on this whiteboard) to get first and last two chars. echo(substr($text, 0 , 1)); echo(" "); echo(substr($text, strlen($text) - 2 , strlen($text))); ?>
Show:  
Copy Clear