Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Remove a portion of the array and replace it with something

Tue Oct 28, 2008 1:25 am

Code:

<?php
   $states
= array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Connecticut");
   
$subset = array_splice($states, 2, -1, array("New York", "Florida"));
   
print_r($states);
?>




Post a reply
  Related Posts  to : Remove a portion of the array and replace it with something
 String replace by index value     -  
 search in a string and replace     -  
 String replace with Regular Expressions     -  
 Remove Indentation     -  
 remove page title     -  
 Remove all the vowels from a string     -  
 Remove border of the linked image     -  
 Add and Remove CSS classes to html tag dynamically     -  
 Remove ordered list numbers     -  
 How to remove special characters from a string in Java?     -  

Topic Tags

PHP Arrays