Skip to content

Instantly share code, notes, and snippets.

@makgithub
Created September 1, 2017 11:42
Show Gist options
  • Save makgithub/ed7c166ac118a92d82ac29a36f7d2e9e to your computer and use it in GitHub Desktop.
Save makgithub/ed7c166ac118a92d82ac29a36f7d2e9e to your computer and use it in GitHub Desktop.
PHP Array insert, delete, view operation using php function
<?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();
}
@makgithub
Copy link
Author

PHP Array insert, delete, view operation using php function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment