In this blog I am going to explain that how to adding array in PHP. So, as stated in the PHP documentation, if you’r only pushing a single element every time (like in a loop ) or a single element once, it’s best to use the #value[] = 15; method not only because it’s less character to the same operation, but it also performance over a function call, which array_push().
It means if you are using in a array single item at a time. If all values are known at the same time, it’s possible best just to use the array_push it depends on how many items must be added the extra character from array name each time may be more of a performance than the function call overhead.
Output-





I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND