PHP : Get the first value from an array

In this tutorial learn how to get the first value from an array in php.

function first($array)
    {
            return array_shift($array);
    }

TUTORIAL

<?php

$array = Array
(
    'user_id' => 10,
    'id' => 2,
    'user' => 'Nakiya',
);
    /**
     * Get the first value from an array.
     */
 function first($array)
    {
            return array_shift($array);
    }


var_dump(first($array));

OUTPUT : demo

int(10)


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...