I have an 18 week schedule and a start date: Total Weeks = 18 Start Date = 9/1/20 I want to know which week number (NOT PHP W but actual number between 1 and 18) at any time. So I would pass into a function: Current Date, Start Date and Total Weeks and it would output what current week number
Tag: range
PHP Generate day range
I am trying to generate the range of days, from 1 to 28, with the English ordinal suffix for the day of the month. For example: 1st of month, 2nd of month… for($i = 1; $i <= 28; $i++) { $...
PHP check if time falls within range, questioning common solution
I have to check if the current daytime falls in a specific range. I looked up the internet and found several similar solutions like this one: If both conditions have to be true, how can this bis achieved when we assume that $start is 06:00:00 and $end is 02:00:00. If we make the assumption that it is 01:00:00, in this
How to get total time from several date ranges in php
I have several date ranges in form of DateTime $begin, DateTime $end. Those ranges can overlap in every possible way: etc. What I am trying to do is to get length (in seconds or DateInterval) of those ranges between start of the first one and the end of the latest one (fourth in the case above), excluding regions not covered
Restriction based on IP ranges
I am building an admin panel. and I want to block certain IP ranges. I’m testing this on my localhost wamp server but ir doesn’t seem to redirect me. Any input is appreciated. Answer Is sufficient to use string comparison Update: Taken from the comments of inits answer Suppose i want to block any IP coming from this range: 192.168.0.1-255.