Skip to content

Instantly share code, notes, and snippets.

@utkarsh27a
utkarsh27a / compare-versions.php
Created October 13, 2020 09:44
a simple 2 version compare function in php
<?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);
@utkarsh27a
utkarsh27a / shyplite-questions.js
Created September 19, 2020 11:14
Shyplite Questions
// 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;
}