Related questions
Remove empty array elements
Some elements in my array are empty strings based on what the user has submitted. I need to remove those elements. I have this:
foreach($linksArray as $link)
{
if($link == '')
{
unset($link);
}
}
print_r($linksArray);
But it doesn't work. $…
Array to String PHP?
What is the best method for converting a PHP array into a string?
I have the variable $type which is an array of types.
$type = $_POST[type];
I want to store it as a single string in my database with …
how to convert array values from string to int?
$string = "1,2,3"
$ids = explode(',', $string);
var_dump($ids);
returns
array(3) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
}
I need for the values to be of type int instead of type string. Is there a better way of doing this than …