Skip to content

Tag: php

Google Cloud Platform – Create instance with IPv4

I’ve using Google Cloud API and I’ve created instance but without IPv4. I need instance with IPv4. Can anyone help me to config AccessConfig? I think I missed something like this: Can anyone help me? Source: https://github.com/googleapis/google-cloud-php/tree/master/Compute/src/V1 And: https://git…

User’s cant upload images on published website

I have a website which you can upload pictures and see them. I was uploading and gettin pictures with no problem on localhost but after publishing with freewebhostingarea i get these errors. Warning: move_uploaded_file(img/pexels-garvin-st-villier-3874337.jpg): failed to open stream: Permission denied in /hom…

PHP change file extension in HTML as plaintext

I want to change file extension in HTML code on PHP output. Probably with regex and this is something I really cannot handle.. …some code…<img data-src=’https://static.example.com/gallery/image.jpg’>…some code… should be changed to …some code…<img data-…

Cluster PHP array

Let’s say I have an array of items with each item a value. I’d like to create a new array where the items are clustered by their relative distance to each other. When an item has a distance of one to another item, they belong to each other. This will create an output of overlapping arrays. What I …

PHP Split XML based on multiple nodes

I honestly tried to find a solution for php, but a lot of threads sound similar, but are not applicable for me or are for completely different languages. I want to split an xml file based on nodes. Ideally multiple nodes, but of course one is enough and could be applied multiple times. e.g. I want to split th…

Symfony mocking repository for testing

I’m trying to mock a repository containing all modules, and it has a method called findAll() that returns all elements from that repository. I cant seem to be able to pull any data from the mocked repository. Any ideas how I could fix it? Mocking repository: Trying to use method from ModuleRepository cl…

PHP getting TIME difference in hours and minutes format

I’m currently new to PHP , and I am stuck on this problem. I cant seem to subtract the TIME IN from employee SCHEDULE PS: I also tried date_diff method, but it doesn’t work on me. THis is what my database looks like Answer I got the answer, i did it like this. Example: shiftstart 08:30:00AM and ti…