Skip to content

Invalid argument supplied for foreach()

It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data. When you feed a foreach with data that are not an array, you get a warning: Warning: Invalid argument supplied for foreach() in […] Assuming it’s not possible to refactor …

Get mime type of external file using cURL and php

I’ve used mime_content_type() and File info but i never successed. i want to use now cURL with PHP and get the headers of the file which is hosted on another domain then extract & determine if the …

What is the “->” PHP operator called? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Closed 4 years ago. Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. What do you call this arrow looking …

preventing direct access to a php page, only access if redirected

I want to make my php page only accessible from another page redirect and prevent my user from accessing it directly. I mean, let’s say I have a page called “main.php” and another PHP file that I want to prevent direct access to, called “noaccess.php”. I want to make noaccess.php…

Get value of input box, without a form?

Does anyone know how I can get the value of an input box, without having a form? I want a submit button, but instead of submitting a form, I want it to change data in a MySQL database. Something like this maybe? Could I use that code on a “onclick” event? The input box’s name and id is &#822…

PHP fetch all Twitter Followers and compare them to friends

I am looking for scalable way to do the following: User login Fetch all Friends from Twitter Fetch all Followers from Twitter Display all Friends which aren’t Followers The Problem: How can this be done in a scalable way? An user can have up to 2 million friends or followers. Currently I’m storing…