1
öğesinden yüksekse öğenin bir dizideki bir öğeden büyük veya ona eşit olup olmadığını kontrol etmek istiyorum.değişken php
Döngüler için birden çok deneme yaptım, ancak daha sonra yığıldılar ve yığınlandılar. Sadece tarihleri almam gerek, örneğin: 01-01-2005/01-01-2006 ve bu ikisini bugünün tarihiyle karşılaştırın ve bugünün tarihinin kitap tarihine göre daha büyük veya eşit olup olmadığını kontrol edin. Kitap eski ise Ve sonra bugünün tarihi bazı kodlar
foreach ($user_out as $userOut) {
$userOut_id[] = $userOut['user_id'];
}
$userOut_id_implode = implode(',',$userOut_id);
//loop through each element from the tocomet able
$dateOfBook = [];
$today = date("d-m-Y");
foreach ($out as $outs) {
$datum = $outs['released'];
//gets the date of the selected book.
$bookDate = date("d-m-Y", strtotime($datum));
$dateOfBook[] = $outs['released'];
//gets the name of the author
$author_name = $outs['author'];
//gets the title of the book
$book_title = $outs['book_title'];
$today = strtotime($today);
$bookDate = strtotime($bookDate);
//checks if today is equal or smaller then the bookdate
}
$today = date("Y-m-d");
$y = count($dateOfBook);
for($x = 0; $x < $y; $x++){
echo $x;
};
if($today >= $dateOfBook($x)){
do stuff
}
'$ dateOfBook' sadece karşılaştırmak istediğiniz öğeye erişmek yapın:' $ dateOfBook [1] ' – Rizier123
Ama hepsini karşılaştırmak istiyorum bugün $ ile. –
@AngelofDemons Neden foreach veya foreach loop kullanmıyorsunuz? – kainaw