n order of array_map and in_array php code example

Example 1: in_array php

<?php
$os = array("Apple", "Banana", "Lemon");
if (in_array("Apple", $os)) {
    echo "Yeah. Exist Apple";
}
if (!in_array("Buleberry", $os)) {
    echo "Oh, Don't Exist Blueberry!!!";
}
?>

Example 2: using array map php

array_map ( callable $callback , array $array1 [, array $... ] ) : array

Example 3: php map array

function cube($number)
{
    return ($number * $number * $number);
}

$nums = [1, 2, 3, 4, 5];
$cubed = array_map('cube', $nums);

Tags:

Php Example