Is there an approach for recursively merging arrays, in the same way as PHP’s array_merge_recursive() function does, except that integer keys are treated the same as string keys? (It’s important for the process that the keys remain parse-able as integers.) For example: Will merge the on the “…
Tag: php
Best way to manage long-running php script?
I have a PHP script that takes a long time (5-30 minutes) to complete. Just in case it matters, the script is using curl to scrape data from another server. This is the reason it’s taking so long; it has to wait for each page to load before processing it and moving to the next. I want to be able
PHP “&” operator
I’m not a PHP programmer (but know other languages), and I’m trying to understand a web page that was done in PHP (5.1.6) in order to do some changes. The page has the following code (simplified): $…
could static members use nonstatic members and vice versa?
could i use nonstatic members inside a static method? eg. and vice versa that is to say use static members inside non-static methods? Answer From http://php.net/manual/en/language.oop5.static.php Declaring class properties or methods as static makes them accessible without needing an instantiation of the clas…
Check if an array contains a specific value?
I’d like to check if there is a value on an array like this: I’ve read the check_value_new method is a better way to work with arrays, but I’m not used to work with it, how I should fix it? Answer PHP offers a function called in_array that checks if a value exists in a given array. You can c…
Sending POST Requests without waiting for response?
I am writing a simple REST service, which responds to requests from clients. All in PHP. My concern is, that when my server responds to a request, it could end up tying up resources if the client …
Change the maximum upload file size
I have a website hosted on a PC I have no access to. I have an upload form allowing people to upload mp3 files up to 30MB big. My server side script is done in PHP. Every time I try and upload a file, I receive an error claiming that the file exceeds the maximum size allowed, so I need
.htaccess deny access to specific files? more than one
I am able to disable access to a file with .htaccess, but I don’t know how to disallow multiple files to be viewed (directly, not from includes) They are .php so I can’t disable a file type (like the only tutorials online say..) Or something.. For example “home.php, file.php , test.php”…
Google Google App Engine for static files in Joomla
I want to use Google App Engine for the static data for my Joomla website. I want to host all the CSS and JS files on App Engine. Answer Joomla is written using PHP. By default Google App Engine only supports applications written in Python, and in the future Java. See Google App Engine FAQ so PHP is not nativ…
PHP case-insensitive in_array function
Is it possible to do case-insensitive comparison when using the in_array function? So with a source array like this: $a= array( ‘one’, ‘two’, ‘three’, ‘four’ ); The following lookups would all …