« first day (4427 days earlier)      last day (507 days later) » 

10:13 AM
Good morning.
 
 
1 hour later…
11:28 AM
I am trying to check if I add a delay of 6 hours from now if that falls between '10:00 pm' and '7:00 am'. So not other way.
If it falls beteen those times then i want calculate the diferent. The date doesnt matter only times.
The problem I am having now is it calculate from '7:00 am' of the current date to my to delayed time. I need to calculate how many hours do I need till the time is at '7:00 am'
  public static function delayedTime(): int
    {
        $now = new DateTime();
        $startPeriod = DateTime::createFromFormat('h:i a', '10:00 pm');
        $stopPeriod = DateTime::createFromFormat('h:i a', '7:00 am');
        $periodAfterDelay = $now->add(new \DateInterval('PT6H'));


        if ($periodAfterDelay < $startPeriod && $periodAfterDelay > $stopPeriod) {
            return 6; //hours
        }
        $hoursToAddToDelay = $periodAfterDelay->diff($stopPeriod)->h;

        return 7 + $hoursToAddToDelay;// no need to watch minutes en seconds
 
12:22 PM
Is anyone else getting giddy about PHP 8.2 almost being available for general/production usage? :D
 
@Girgias You're not alone. That's one of the reasons I hate the ML. I've stopped trying to argue on the ML, I only inform.
 
Morning
 
o/
 
1:08 PM
morning all
I have a question: why an anonymous class cannot have attributes?
<?php
#[Attribute] class Foo {}
var_dump((new ReflectionClass(#[Foo] new class Bar {}))->getAttributes());
This gives an error at new keyword
 
1:41 PM
morns
 
it is morning, I'll give you that :)
 
 
1 hour later…
2:56 PM
\o
 
o/
 
3:30 PM
Hoi! I just found some interesting behaviour in PHP, can someone explain the reasoning?
https://3v4l.org/UeI7g
In short, the static in self::create() seems to ignore that self is supposed to be Base and not Child.
 
how do I tell composer to use another version of php on the same machine?
 
@Jimbus you can't...by the time composer is running, PHP is already "selected" for you
you could do it out of composer though - changing PATH or changing the composer shell script's shebang to use a different PHP.
or a shell alias composer="yourphp /path/to/composer"
 
Morning
 
4:01 PM
@TimWolla I gave the error/exceptions for date/time a last go-over. Can you "resolve" the ones where you have no more additional comments/disagreements?
 
frak, I hate working in windoze, half my tools are missing. in this case touch
 
4:26 PM
and tail
 
@Christian I'm not sure it's a bug, but in any case, I would recommend against writing code like this.
 
@LeviMorrison it's of course an example, but which part would you recommend against specifically?
 
Late static binding.
 
new static() is probably not a good idea since in PHP we can change constructor signatures (unlike other methods)
is that what you mean?
 
No, don't use static:: or such at all.
 
4:44 PM
I understand static::method() (which implies static class methods) isn't a good idea, but static::class is very useful.
Is your concern against static methods, or LSB? I don't see any problems with LSB in general (so maybe elaborate a bit more on why?).
 
5:06 PM
does composer require pear?
 
5:20 PM
PHP Fatal error: Uncaught Error: Failed opening required '../vendor/autoload.php' (include_path='.;C:\php\pear')
but I can't figure out where that's coming from
I nuked my vendor/ composer* and installed, tried updating --no-scripts --dump-autoload...
 
@Jimbus pear is just in your include_dir... composer doesn't require pear
nuking vendor will get you that error... you need to run composer install to get back your vendor dependencies (assuming you still have composer installed)
*include_dir => include_path, which is like PHP's version of the OS' PATH
suggestion: if you are loading your dependencies with require_once '../vendor/autoload.php';, use an absolute path instead: require_once __DIR__ . '/../vendor/autoload.php';
 
5:47 PM
Gah! it wasn't finding the autoload.php because it needed to change the hard coded path on this production machine, but it totally threw me off with the (include_path='.;C:\php\pear') bit
<-- pulls out an imaginary handgun and shoots himself in the foot, yet again...
 
6:47 PM
Here's a fun question. Does PHP have a way to report to userspace what CPU arch it's running on? (amd64, aarch64, etc.)
 
php_uname ?
php.net/manual/en/function.php-uname.php — php_uname("m") — then
 
There's an app for that... er, built in function for that
 
Ahso. Merci bien!
 
 
1 hour later…
8:15 PM
Woo Hoo! I just figured that the remote machine is actually mounted as a drive so I can edit using my cygwin shells instead of using remote desktop with power shell! grep and tail are mine!
 
8:33 PM
@Derick "catching Date/Time extensions" should be "exceptions" in your DateTime exceptions RFC
A typo
 
My new project: Learn Access... yeah
 
@Derick your RFC after backward incompatible changes has two copies of next couple of sections.
 
Do you get a day off of work in the UK for the Harvest Festival?
 
8:49 PM
Hello

Guys, I'm trying to convert videos to GIF using laravel framework (in shared hosting). How can I do that? any help please
 
 
1 hour later…
10:13 PM
@MohammedAlaiadhy First googling for "github php video to gif" gives something like this. But there question stays if you can have it working on shared server (i.e. is there enough of memory dedicated or are required binaries available/accessible).
 
@Tpojka Thanks for helping, yes this package requires FFMPEG which unfortunately couldn't be installed in shared hosting servers.
 

« first day (4427 days earlier)      last day (507 days later) »