Searching in Arrays in PHP
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Check that it contains an element with the value
3
.
Given an array:
<?php
$arr = ['a', '-', 'b', '-', 'c', '-', 'd'];
?>
Find the position of the first element '-'
.
Given an array:
<?php
$arr = ['a', '-', 'b', '-', 'c', '-', 'd'];
?>
Find the position of the first element '-'
and remove it using the array_splice
function.