<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >array_unshift</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Array - funcþii" HREF="ref.array.html"><LINK REL="PREVIOUS" TITLE="array_unique" HREF="function.array-unique.html"><LINK REL="NEXT" TITLE="array_values" HREF="function.array-values.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.array-unique.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.array-values.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.array-unshift" ></A >array_unshift</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN6900" ></A ><P > (PHP 4 , PHP 5)</P >array_unshift -- Prepend one or more elements to the beginning of array </DIV ><DIV CLASS="refsect1" ><A NAME="AEN6903" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >array_unshift</B > ( array array, mixed var [, mixed ...])<BR ></BR ><P > <B CLASS="function" >array_unshift()</B > prepends passed elements to the front of the <VAR CLASS="parameter" >array</VAR >. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. </P ><P > Returns the new number of elements in the <VAR CLASS="parameter" >array</VAR >. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN6923" ></A ><P ><B >Exemplu 1. <B CLASS="function" >array_unshift()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> $queue = array ("orange", "banana");<br />array_unshift ($queue, "apple", "raspberry");</font> </code></TD ></TR ></TABLE ><P > This would result in <VAR CLASS="varname" >$queue</VAR > having the following elements: <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> Array<br />(<br /> [0] => apple<br /> [1] => raspberry<br /> [2] => orange<br /> [3] => banana<br />)</font> </code></TD ></TR ></TABLE > </P ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.array-shift.html" ><B CLASS="function" >array_shift()</B ></A >, <A HREF="function.array-push.html" ><B CLASS="function" >array_push()</B ></A >, and <A HREF="function.array-pop.html" ><B CLASS="function" >array_pop()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.array-unique.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.array-values.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >array_unique</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.array.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >array_values</TD ></TR ></TABLE ></DIV ></BODY ></HTML >