Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Call to undefined function array_key_last()" although it is a PHP function that works locally

I made a website that works perfectly locally. Now I'm trying to publish it online with ploi.io . I get this error:

"Call to undefined function array_key_last()" 3rd line in code

but array_key_last() is a PHP-function.

https://www.php.net/manual/en/function.array-key-last.php

Here is my website link: http://rocallisa.xyz/

if($key === array_key_last($photos))

My server is running PHP 7.3 but this doesn't help.

like image 751
Niel Agneessens Avatar asked Nov 18 '25 00:11

Niel Agneessens


1 Answers

What is the PHP version in the online publication?

In PHP docs:

array_key_last (PHP 7 >= 7.3.0)

https://www.php.net/manual/es/function.array-key-last.php

Is the version of your remote server latter than 7.3?

An alternative: How to get last key in an array?

like image 126
Dan A.S. Avatar answered Nov 20 '25 16:11

Dan A.S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!