I am trying to figure out what the best/most efficient way to get individual /24 IP blocks from a range of IP addresses using PHP. I have ranges of IP addresses in an MySQL database (I cannot change how this is presented) and have to have individual ranges of /24 blocks saved, also in a specific way (I cannot…
Tag: php
If str_ireplace() doesn’t meet php condition
I have a code where I match comma-separated words to text using the str_ireplace() function: Please tell me how can I do the reverse logic? Those. if nothing is found or matched. else {} does not work. Full code: Answer The problem is that you’re adding the default categories whenever you don’t ma…
imap_setflag_full seems to do nothing?
I’m trying to flag a message as seen: The output is bool(true) but when I then re-fetch my messages (imap_fetch_overview) this is what I see: Clearly I’m doing something wrong, but I can’t spot what. Answer As written in the comments of imap_setflag_full, pop3 apparently does not support fla…
new DateTime is not working properly with the future date
I am trying to calculate the differences between 2 dates. The first date is the reservation date, and the second date is the traveler’s birthdate. Format of the $tour_day is 15 December, 202X It works if the reservation date is the current year. However if the reservation date is 2022 or more, than it c…
Laravel – simpliest elseif [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago. Improve this question Hi, have i to do it more simple or its a normal practice? Answer Ins…
How insert Multiple Array item into One Array in PHP
i want to add multiple Array item into One Array Object in PHP i have array like below : And i need to Convert like below: Array Data maybe changed , but , i write this code for explain my problem : But this code returns the same as the first array! I want to return every item into one
Replace every string in multidimensional array if conditions matched
Ok so I have an array look like this, What I want to do is, in any element of this multidimensional array I want to replace any string that have a . with removing everything after . So the new array should look like this, I have tried doing this, I’m getting $value[0] as order_date but can’t figur…
display array keys as table headers and values in sub arrays as table rows in php?
i have the following array. how to display array keys as headers and values of keys which are also arrays as table rows. i have displayed array keys headers like this. how to display the values as table rows. Answer here is tested solution:
Return S3 private file as stream
I’m currently working on a route for a project that I need to get a specific file from S3, read its content, and return as a binary. I can’t just use the S3 file url, because it is private and it is intentional (we just don’t want the bucket files open). But the problem is, I want to stream …
join tables and see the count of categories in each category name in laravel 8
excuse me want to ask. I’m sorry in advance if my language is not neat I have a category table with colom -id (pk) -name -and others and i have a post table with colom -id (pk) -category_id(fk) and others I want to count the number of posts from each category along with the category name in laravel 8. t…