Skip to content
Snippets Groups Projects
Commit 311536c0 authored by Iqbal's avatar Iqbal
Browse files

Deleted mockup data

parent 394bbaf9
No related merge requests found
<?php
/**
* Created by PhpStorm.
* User: iqbal
* Date: 03/10/17
* Time: 23:43
*/
$emailList = array("iqbal@gmail.com", "test@ymail.com", "cloud@dagojek.com");
$emailInput = $_REQUEST["q"];
if (filter_var($emailInput, FILTER_VALIDATE_EMAIL)) {
$response = checkAvailability($emailInput, $emailList);
} else {
$response = "unavailable";
}
echo $response;
function checkAvailability($string, $aList) {
if ($string !== "") {
$found = false;
$i = 0;
while ($i < count($aList) && !$found) {
if ($string === $aList[$i]) {
$found = true;
} else {
$i++;
}
}
if ($found) {
return "unavailable";
} else {
return "available";
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: iqbal
* Date: 03/10/17
* Time: 23:43
*/
$usernameList = array("iqbal", "test", "cloud");
$usernameInput = $_REQUEST["q"];
$response = checkAvailability($usernameInput, $usernameList);
echo $response;
function checkAvailability($string, $aList) {
if ($string !== "") {
$found = false;
$i = 0;
while ($i < count($aList) && !$found) {
if ($string === $aList[$i]) {
$found = true;
} else {
$i++;
}
}
if ($found) {
return "unavailable";
} else {
return "available";
}
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment