Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
You must login to add post.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
I want to delete an element from an array.
<?php
// $lang is my array variable
// Delete element using unset()
$lang = array(“C”, “JAVA”, “ASP”, “C++”, “PHP”);
unset($lang[3]);
print_r ($lang);
// Delete element using array_slice()
echo “<br>”;
print_r(array_slice($lang,2));
?>
OUTPUT:
Array ( [0] => C [1] => JAVA [2] => ASP [4] => PHP )
Array ( [0] => ASP [1] => PHP )