php

Disable Zend Autoloader

How can I disable the Zend_Loader_Autoloader? ...

Faking MS exchange whith php

Hi guys, first post on stackoverflow! We are developing a php contact manager. We wanted to create the possibility to sync the contacts with ms exchange enabled phones (android, iphone, blackberry). I found this link http://www.troywolf.com/articles/php/exchange_webdav_examples.php#create_contact but what I need is more on the sync side,...

Get Version of exe via PHP

Is getting the version of a exe possible with php? I'd like to print the version of a file that can be downloaded... Windows exe and php is running on linux server ...

php - safest way to ensure plain text

What is the most secure way to stop users adding html or javascript to a field. I am adding a youtube style 'description' where users can explain their work but I don't want anything other than plain text in there and preferable none of the htmlentities rubbish like '<' or '>'. Could I do something like this: $clean = htmlentities($_PO...

Installing PostGresQL & MySQL in Mac OS X running MAMP?

Well, I have MAMP installed on my Mac OS X, and I've got PostGres up and running, but am wondering how I can use it with PHP? I'm assuming that there's something I need to do where I compile PHP so that it can use both, but, I'm not sure how to do that if PHP has already been installed? Or, if there's something unique I need to do to g...

KeepAlive packets over a Soap request

I've been debugging some Soap requests we are making between two servers on the same VLAN. The app on one server is written in PHP, the app on the other is written in Java. I can control and make changes to the PHP code, but I can't affect the Java server. The PHP app forms the XML using the DOMDocument objects, then sends the request us...

How to check if an array has an element at the specified index?

I know there is array_key_exists() but after reading the documentation I'm not really sure if it fits for this case: I have an $array and an $index. Now I want to access the $array, but don't know if it has an index matching $index. I'm not talking about an associative array, but an plain boring normal numerically indexed array. Is the...

Can you use Eclipse's .Project files variables for Code Style variables?

I want a way to have my code style do something like this.. this comment is in PHP but the concept should work for any eclipse compatible language. /* * @author ${user} * @version ${version} */ I would want to update the version variable once, then commit to the repository. So, now when others add comments it would include the Versi...

OOP: How would you set up an Artist, Album & Song relationship in OOP

I understand the basics of inheritance but this one is confusing me. How would you go about saying: An album object has one or more artist objects An album object has one or more song objects My current code only will only allow one song per object: class Song extends Album{} class Album extends Artist{} I'm sure i'm overlooking s...

PHP preg_match to find multiple occurrences

What is the correct syntax for a regular expression to find multiple occurrences of the same string with preg_match in PHP? For example find if the following string occurs TWICE in the following paragraph: $string = "/brown fox jumped [0-9]/"; $paragraph = "The brown fox jumped 1 time over the fence. The green fox did not. Then the br...

How to call dynamically an method in PHP?

Example: I have an variable like $method = "doSomething"; Assume that I have an $myObject which knows a nonstatic, public method doSomething() Could I then just call that method by doing this? $myObject->$method(); Or is there another / better way? ...

Upload files not working, whats wrong with this code?

This is the PHP code used for the upload: $upload = "uploads/"; $upload = $upload . basename($_FILES['bgimage']['name']); if (move_uploaded_file($_FILES['bgimage']['tmp_name'], $upload)) { echo "The file has been uploaded successfully."; } else { echo "Error"; } When I test the script, it says "The file has been uploaded succes...

Dependency Injection simple implementation

Hi, after reading this question i wonder if someone can help me understand how to implement correctly Dependency Injection with these PHP Classes: class DBClass { private $mMysqli; function __construct(mysqli $database) { $this->mMysqli=$database; } function __destruct() { $this->mMysqli->close(...

Which MySQL data types should I not be quoting during an INSERT?

As a beginner with MySQL, I want to get this right. My main hangup right now is the DECIMAL type. From the docs: As of MySQL 5.0.3, values for DECIMAL columns are represented using a binary format that packs nine decimal (base 10) digits into four bytes. Before MySQL 5.0.3, DECIMAL columns are represented as strings and st...

php-5.3.1-Win32-VC9-x86.zip alternative download location?

Hello. http://windows.php.net is currently down, it seems (gives me 404 error). Anyone knows where I can download php-5.3.1-Win32-VC9-x86.zip? When windows.php.net is expected to be up? Thanks. P.S. Isn't this a question for serverfault? Couldn't decide for sure... ...

packages in php?

in java you can have same type of classes and interfaces in same package. i wonder how you could organize code in this way in php. have them in different folders? or use extend on them so you at least can organize them by superclass? (which you could do in java also). ...

Large http uploads failing with uploadify/php on Dreamhost

Ive been having trouble with a php and JavaScript upload script accepting large file uploads with Dreamhost. I realize that you are supposed to edit php.ini to change post max size and the memory limit, but it isn't behaving as it should. The only way I have ever successfully had a large file upload was switching to Dreamhost PS and mak...

After Form Submit, Replace Content With Message Using PHP Only

I have a popup that contains a subscriber sign up form. After the user clicks subscribe I want the form be removed and display a thank you message. All this needs to run using php. Below is what I have so far, but the popup doesn't stay up and when clicking on the subscribe button again it shows the form validation errors because the '...

are arrays in php passed by value or by reference?

When an array is passed as an argument to a method or function is it passed by reference? What about doing this: $a = $array(1,2,3); $b = $a Is $b a reference to $a? ...

Can PHP detect the status code that it has or is preparing to send to the browser?

I am sending a status code via the header function, such as header('HTTP/1.1 403');, and would like to in another area of my code detect what status code is to be sent (in particular if I have sent an error code of some nature). As has been mentioned elsewhere, headers_list() does not return this particular item, and it's unclear to me i...