Search
 
SCRIPT & CODE EXAMPLE
 

PHP

searching and removing element from an array php

<?php
$hackers = array ('Alan Kay', 'Peter Norvig', 'Linus Trovalds', 'Larry Page');

print_r($hackers);

// Search
$pos = array_search('Linus Trovalds', $hackers);

echo 'Linus Trovalds found at: ' . $pos;

// Remove from array
unset($hackers[$pos]);

print_r($hackers);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel get request in blade 
Php :: php get string before character 
Php :: laravel carbon human readable 
Php :: php calculate percentage 
Php :: disable register laravel 
Php :: display exception in blade laravel 
Php :: docx file validation laravel 8 
Php :: sort array by key value in php 
Php :: php sleep half a second 
Php :: wordpress print post data 
Php :: Laravel factory avatars 
Php :: php add days to date 
Php :: wordpress disable editor 
Php :: laravel get latest record by date 
Php :: collection pluck remove duplicates 
Php :: Wordpress Pagination for WP_Query 
Php :: if post id is wordpress php 
Php :: 419 page expired in laravel 
Php :: php var dump die 
Php :: block direct access to php images 
Php :: php array exists key 
Php :: link input button in php 
Php :: PHP Forward POST content into Python script 
Php :: one item limit on cart in woocommerce 
Php :: laravel install production 
Php :: file get content using call api in php 
Php :: how to forget session in laravel 
Php :: pathtophp in ubuntu lampp 
Php :: how to catch query exception in laravel 8 
Php :: php find lowest value in associative array 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =