PHP : Remove the first value from an array

In this tutorial learn  Remove the first value from an array in php.

function removeFirstelement($array)
  {
        array_shift($array);

        return $array;
  }



TUTORIAL


<?php

$array = Array
(
    '3' => 10,
    '2' => 2,
    '5' => 'Nakiya',

);
      
      
    /**
     * Remove the first value from an array.
     */
    function removeFirstelement($array)
    {
        array_shift($array);

        return $array;
    }

var_dump(removeFirstelement($array));
OUTPUT DEMO

array(2) {
  [0]=>
  int(2)
  [1]=>
  string(6) "Nakiya"
}

No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...