<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Add/insert a new value at the specified index</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.spldoublylinkedlist.html">SplDoublyLinkedList</a></div> <div class="next" style="text-align: right; float: right;"><a href="spldoublylinkedlist.bottom.html">SplDoublyLinkedList::bottom</a></div> <div class="up"><a href="class.spldoublylinkedlist.html">SplDoublyLinkedList</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="spldoublylinkedlist.add" class="refentry"> <div class="refnamediv"> <h1 class="refname">SplDoublyLinkedList::add</h1> <p class="verinfo">(PHP 5 >= 5.5.0, PHP 7)</p><p class="refpurpose"><span class="refname">SplDoublyLinkedList::add</span> — <span class="dc-title">Add/insert a new value at the specified index</span></p> </div> <div class="refsect1 description" id="refsect1-spldoublylinkedlist.add-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>SplDoublyLinkedList::add</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$index</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$newval</code></span> )</div> <p class="para rdfs-comment"> Insert the value <code class="parameter">newval</code> at the specified <code class="parameter">index</code>, shuffling the previous value at that index (and all subsequent values) up through the list. </p> </div> <div class="refsect1 parameters" id="refsect1-spldoublylinkedlist.add-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">index</code></dt> <dd> <p class="para"> The index where the new value is to be inserted. </p> </dd> <dt> <code class="parameter">newval</code></dt> <dd> <p class="para"> The new value for the <code class="parameter">index</code>. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-spldoublylinkedlist.add-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 errors" id="refsect1-spldoublylinkedlist.add-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Throws <a href="class.outofrangeexception.html" class="classname">OutOfRangeException</a> when <code class="parameter">index</code> is out of bounds or when <code class="parameter">index</code> cannot be parsed as an integer. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.spldoublylinkedlist.html">SplDoublyLinkedList</a></div> <div class="next" style="text-align: right; float: right;"><a href="spldoublylinkedlist.bottom.html">SplDoublyLinkedList::bottom</a></div> <div class="up"><a href="class.spldoublylinkedlist.html">SplDoublyLinkedList</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>