note 73434 deleted from ref.array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: admin \x40 uostas.net 

----

simple function to remove element from array
saving index sequence
<?php

function array_remval($val,&$arr){
  $i=array_search($val,$arr);
  if($i===false)return false;
  $arr=array_merge(array_slice($arr, 0,$i), array_slice($arr, $i+1));
  return true;
}
?>

example:
<?php
$input=Array('a','b','c','d','e');
array_remval('d',$input);
//result:
//Array('a','b','c','e');
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.