The Ds\Stack::push() function of PHP is used to add elements at the end of the stack. That it is used to push elements on to a stack. The elements being pushed can be of mixed data types.
void public Ds\Stack::push ($values)
Parameter: This function accepts a single parameter $values which is used to push onto the stack.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Stack::push() function:
Ds\Stack Object (  => GfG  => to  => Welcome )
Ds\Stack Object (  => 5.5  => 10  => GfG  => to  => Welcome )
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.