This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function versionCompare($v1, $v2) { | |
# This will split both the versions by '.' | |
$v1parts = explode(".", $v1); | |
$v2parts = explode(".", $v2); | |
# converts to integer from string | |
$v1parts = array_map(intval, $v1parts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Question 1: Create an Array from 0...100 without using traditional For-loop | |
function getNumbers(from, to) { | |
let arr = []; | |
while (from <= to) { | |
arr.push(from); | |
from++; | |
} | |
return arr; | |
} |