In my project I have array and when I echo it using pre
tag it display like this.
Array
(
[0] => stdClass Object
(
[minute] => 1,31
[hour] => 0-5
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 adjkerntz -a
)
[1] => stdClass Object
(
[minute] => 1
[hour] => 3
[mday] => 1
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.update_bogons.sh
)
[2] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout
)
[3] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 webConfiguratorlockout
)
[4] => stdClass Object
(
[minute] => 1
[hour] => 1
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.dyndns.update
)
[5] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
)
[6] => stdClass Object
(
[minute] => 30
[hour] => 12
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.update_urltables
)
[7] => stdClass Object
(
[minute] => */1
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/local/www/checksum.php
)
)
Now I want to check if command=/usr/local/www/checksum.php is exist or not. so, I made this code
if (!in_array('/usr/local/www/checksum.php', $array['command'])) {
echo 'not';
}
else{
echo 'yes';
}
But it always echo not...and warning displayed like Message: Undefined index: command. I don't know how to do it. Please help me.