Skip to content

Tag: php

How to use class methods as callbacks

I have a class with methods that I want to use as callbacks. How can I pass them as arguments? Answer Check the callable manual to see all the different ways to pass a function as a callback. I copied that manual here and added some examples of each approach based on your scenario. Callable A PHP function is …

Download images from html and keep the folder structure

I need to have download over 100.000 pictures. The Pictures have : .png, .jpg, .jpeg, .gif format. I have the approval to use those pictures. they have provide me an XML file with all the url`s The url have the structure otherdomain/productimages/code/imagename.jpg/.png/.gif I have all the codes in an php arr…

Use proxy to connect to a mysql db through PDO

I’m trying to connect to a remote mysql database with PHP PDO (php version 5.3) and I need it to go through a proxy. My connection looks like this right now. I’dd need it to go through a proxy, like http://proxy.mydomain.com:port I’ve searched through the PDO Doc and can’t seem to find…

What does isDirty() mean in Laravel?

First of all, I am not familiar with Laravel so much (or with the term “dirty” for that matter). I stumbled upon this line of code – And I couldn’t understand what that means exactly. I tried to find out on the internet but the Laravel site only says this “Determine if a given at…

PHP array stringify

In a lyrics application I’m coding, I’m using an array to print an artists table. The artists array looks like this: Before printing it, I do some modification to the array. I have a folder for each artist that contains the lyrics files. I add the folder names to the $artists array for later use: …