Answers for "end php function"

PHP
17

how to get last array element in php

<?php

$source_array = ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];

$result = end($source_array);

echo "Last element: ".$result;

?>
Posted by: Guest on August-05-2020
5

php quit

exit();		// Normal exit

exit(1);	// Exit with an error code

exit('Error!');	// Exit and print an error message
Posted by: Guest on June-01-2020

Browse Popular Code Answers by Language