How To Get First And Last Value In Php?
Hi guys,
Today i will explained to the How To Get First And Last Value In Php. This example is so easy to use in php. THis example to use current() and end() function to use.
Current() and end() function is provides to the php. The current() function is use array first value and end() function is use last value of array.
So let's start to the example and follow to the my all step.
Solution
echo current($language) . "<br>";
echo end($language);
Example :
This exampel to i will used to 4 value array create.
<?php
$language = array("laravel", "php", "java", "odo");
echo current($language) . "<br>";
echo end($language);
?>
Output :
laravel
odo
So, finally we are done with our code we can get below output.
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example