I am trying to compare indexes in one array, if all indexes are not the same then It should dispay error. If they are same, take one value as string.
First I retrieve data from db,
$idNaloga = array();
while($r=$ss->fetch()){
$idNaloga[] = $r['idNaloga'];
}
If I receive array like this, it should display error because of 72
array(3) {
[0]=>
string(2) "19"
[1]=>
string(2) "19"
[2]=>
string(2) "72"
}
If result is, it should take 19 as string.
array(4) {
[0]=>
string(2) "19"
[1]=>
string(2) "19"
[2]=>
string(2) "19"
[3]=>
string(2) "19"
}
I was trying to use array_unique() function, but could not get correct result. I was googling but could not find it.