1
How can I check for the "2017-11-15" string in this array?
array(4) {
[0]=>
object(stdClass)#43 (1) {
["date"]=>
string(10) "2017-11-13"
}
[1]=>
object(stdClass)#44 (1) {
["date"]=>
string(10) "2017-11-14"
}
[2]=>
object(stdClass)#45 (1) {
["date"]=>
string(10) "2017-11-15"
}
[3]=>
object(stdClass)#46 (1) {
["date"]=>
string(10) "2017-11-16"
}
}
I tried that way and I couldn’t:
$string = "2017-11-15";
if(in_array($string, (array) $proposal_dates)){
echo 'existe no array.';
} else{
echo 'nao existe no array';
}
Can’t store a string in place of the object? so it’s easier to compare.
– rray
you say the return of the array?
– viniciussvl
Yeah, you’re using the class
DateTime()
?– rray
This array comes from the database, I make a select and returns to me all dates referring to that ID. I am not using this class.
– viniciussvl