Created
September 1, 2017 11:42
-
-
Save makgithub/ed7c166ac118a92d82ac29a36f7d2e9e to your computer and use it in GitHub Desktop.
PHP Array insert, delete, view operation using php function
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 | |
class arrayFunctions{ | |
public $dialedCustomers; | |
function __construct($array) { | |
$this->dialerCustomersCount=$array; | |
} | |
public function getValue(){ | |
var_dump($this->dialerCustomersCount); | |
} | |
public function insertData($value) | |
{ | |
$this->dialerCustomersCount[]=$value; | |
} | |
public function checkValue($searchValue) | |
{ | |
return array_search($searchValue, $this->dialerCustomersCount); | |
} | |
public function deleteValue($deleteIndex){ | |
array_splice($this->dialerCustomersCount, $deleteIndex, 1); | |
} | |
} | |
$input = array("red", "green", "blue", "yellow"); | |
$values= new arrayFunctions($input); | |
$values->insertData("57@1000"); | |
$values->getValue(); | |
//checking the value | |
$status=$values->checkValue("green"); | |
$values->getValue(); | |
if($status != false){ | |
$values->deleteValue($status); | |
$values->getValue(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP Array insert, delete, view operation using php function