Search
 
SCRIPT & CODE EXAMPLE
 

PHP

key of last element php

//(PHP 7 >= 7.3.0)
$key = array_key_last($data);

//ALL PHP Versions
end($data);         // move the internal pointer to the end of the array
$key = key($data);  // fetches the key of the element pointed to by the internal pointer

Comment

php last item of array

echo end(['Gon', 'Killua', 'Hisoka']) // print Hisoka
Comment

PREVIOUS NEXT
Code Example
Php :: generate autodump laravel 
Php :: laravel response redirect 
Php :: A table was not found You might have forgotten to run your migrations. You can run your migrations using php artisan migrate. Pressing the button below will try to run your migrations. 
Php :: php exception message 
Php :: api headers php 
Php :: php check if cli 
Php :: php curl delete request 
Php :: complete url php 
Php :: php get only numbers 
Php :: how to create controler in laravel 
Php :: php delete array item by value 
Php :: group by codeigniter 3 
Php :: set charset of response php 
Php :: php date timestamp now 
Php :: select case default php 
Php :: laravel find or create new 
Php :: php sha256 
Php :: php image to base64 
Php :: php mysql insert data 
Php :: create laravel project using laravel installer 
Php :: codeigniter 3 insert 
Php :: php get location of user 
Php :: The mysqli extension is missing. Please check your PHP configuration. 
Php :: laravel debugbar false not working 
Php :: php newline 
Php :: laravel change column type 
Php :: yii2 redirect back 
Php :: php create 404 error 
Php :: php get age from dob 
Php :: php color echo 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =