180508/how-to-add-elements-to-an-empty-array-in-php
I define an array in PHP :
$cart = array();
Can I simply add elements to it using the following?
$cart[] = 13; $cart[] = "foo"; $cart[] = obj;
Is this the right way? or is there another way to do this?
Hello @kartik, Use array_unique(): Example: $array = array(1, 2, 2, 3); $array ...READ MORE
Hii, You can pass an associative array to http_build_query() and ...READ MORE
What can I do to get the ...READ MORE
I want to convert a string into ...READ MORE
I have an array called reverse array ...READ MORE
I have this array: Array ( [data] => ...READ MORE
Since the 'second dimension' could be just ...READ MORE
Hello @ abhittac, You have create the array everytime the ...READ MORE
Start with simply typecasting the line:- $array = ...READ MORE
What is the difference between var_dump() and print_r() in terms of ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.