Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php printf("Current PHP version: %s \n", phpversion()); $arr = array( "2020-08-09 11:22:33" => "2020-08-09 2021", "2020-08-09 11:01:44" => "2020-08-09 2022", "2020-08-09 11:36:21" => "2020-08-09 2023", "2020-08-08 10:22:55" => "2020-08-09 2024", "2020-08-08 07:22:28" => "2020-08-09 2025", "2020-08-08 17:22:32" => "2020-08-09 2026", "2020-08-07 18:52:45" => "2020-08-09 2027", "2020-08-06 11:22:33" => "2020-08-09 2021", "2020-08-05 11:01:44" => "2020-08-09 2022", "2020-08-04 11:36:21" => "2020-08-09 2023", "2020-07-06 10:22:55" => "2020-08-09 2024", "2020-07-07 07:22:28" => "2020-08-09 2025", "2020-07-08 17:22:32" => "2020-08-09 2026", "2020-07-07 18:52:45" => "2020-08-09 2027", "2020-06-09 11:22:33" => "2020-08-09 2021", "2020-06-10 11:01:44" => "2020-08-09 2022", "2020-06-09 11:36:21" => "2020-08-09 2023", "2020-06-08 10:22:55" => "2020-08-09 2024", "2020-06-07 07:22:28" => "2020-08-09 2025", "2020-05-04 17:22:32" => "2020-08-09 2026", "2020-05-05 18:52:45" => "2020-08-09 2027", "2020-05-08 11:22:33" => "2020-08-09 2021", "2020-05-09 11:01:44" => "2020-08-09 2022", "2020-05-10 11:36:21" => "2020-08-09 2023", "2020-05-11 10:22:55" => "2020-08-09 2024", "2020-04-08 07:22:28" => "2020-08-09 2025", "2020-04-08 17:22:32" => "2020-08-09 2026", "2020-04-07 18:52:45" => "2020-08-09 2027" ); //print_r($arr); $dates_array = array(); foreach($arr as $key => $value) { $new_date = date("Y-m-d",strtotime($key)); $dates_array[] = $new_date; } $result = array_unique($dates_array); //print_r($dates_array); //to print array collection print_r($result); function isWednesday($date) { return date('w',strtotime($date)) === '3'; } $wed_array = []; foreach($result as $val) { if (isWednesday($val)) { $wed_array[]=$val; } } print_r($wed_array);
Copy Clear