PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I remove an element from an array without changing the index values for the rest of the array?


If you want to completely remove a value from an array, then you should unset it.

For instance, if you create an array of the numbers from A - Z then the index values are 0 - 25.

If you then unset the value at index 2 (C) then the rest of the array keeps its index - value correlation intact.

<?php
$letters 
range("A","Z");
unset(
$letters[2));
print_r($letters);
?>


Copy and paste that to see the results... if that wasn't the question you were asking then please re-post with more explicit details of what you're looking for.



ASK A QUESTION

More arrays PHP Questions

Translation Composition Nationalism European Grammar Arabic Poetry Prose ******************************* I want an array equation that helps me to calculate some of varibles unspecific

How do I reverse sort the members of an array?

how a values entered in an array from keyboard?

I have the following list : Tom T1 Tom T2 Bill T1 Bill T2 Jack T1 Jack T2 I need it converted into : Tom T1,T2 Bill T1,T2 Jack T1,T2

what is a array?



Custom Search