112 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of 112.php
- <?php
- function digitValue($str){
- $n = filter_var($str, FILTER_SANITIZE_NUMBER_INT);
- $length = strlen($n);
- for ($i = 0; $i < $length; $i++){
- if (is_numeric($n[$i]))
- $zero = $length - $i -1;
- echo $n[$i] . str_repeat(0,$zero) ."\n";
- }
- }
- digitValue('9,327,421');
- function triangle(){
- $str = range(1,9);
- $length = count($str);
- for ($i = 0; $i < $length; $i++){
- $x = array_slice($str,$i);
- echo implode(' ', $x) . "\n";
- }
- }
- triangle();
- function odde($n){
- echo '[';
- for ($i = 1; $i < $n; $i++) {
- if (($i % 2) != 0) {
- echo $i . ' ';
- }
- }
- echo ']';
- }
- odde(15);
File Description
- 112
- PHP Code
- 22 Mar-2023
- 637 Bytes
You can Share it: