php

The best PHP editor for Vista

Some points to consider when answering my question: I'm new to PHP, coming from a Windows / .NET background My PHP dev enviroment consists of a Vista x64 / IIS7 with FastCGI / PHP5 I need something light-weight The following features would be nice Syntax highlighting and colorization Code formating Auto-completion ...

how to get the number of apache children free within php

How in php can I get at the number of apache children that are currently available (status = SERVER_READY in the apache scoreboard)? I'm really hoping there is a simple way to do this in php that I am missing. ...

What XML parser do you use for PHP?

I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinng a warning. ...

foreach access the index or an associative array

I have the following code snippet. $items['A'] = "Test"; $items['B'] = "Test"; $items['C'] = "Test"; $items['D'] = "Test"; $index = 0; foreach($items as $key => $value) { echo "$index is a $key containing $value\n"; $index++; } Expected output: 0 is a A containing Test 1 is a B containing Test 2 is a C containing Test 3 is a...

can I get PHP to stop replacing '.' characters in $_GET or $_POST arrays ?

Hiya - If I pass PHP variables with '.' in their names via $_GET PHP auto-replaces them with '_' characters. For example: <?php echo "url is ".$_SERVER['REQUEST_URI']."<p>"; echo "x.y is ".$_GET['x.y'].".<p>"; echo "x_y is ".$_GET['x_y'].".<p>"; ... outputs the following: url is /SpShipTool/php/testGetUrl.php?x.y=a.b x.y is . x_y is ...

PHP: Can I reference a single member of an array that is returned by a function ?

Hi - any idea how if the following is possible in PHP as a single line ?: <?php $firstElement = functionThatReturnsAnArray()[0]; ... It doesn't seem to 'take'. I need to do this as a 2-stepper: <?php $allElements = functionThatReturnsAnArray(); $firstElement = $allElements[0]; ... just curious - other languages I play with allow th...

Where am I supposed to see FirePHP output?

Ok, so I am finally trying out FirePHP. I installed it and restarted firefox, enabled firebug for my localhost, moved the demo oo.php file that comes with the download into an IIS virtual directory, changed the include path, removed the apache_request_headers() call since I am running IIS and the only output I see? Notice: Undefined...

Zend PHP debugger: How can I start debugging a page using a get argument?

I am trying out the debugger built into Zend studio. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page? For example, I don't want to debug runtests.php I want to debug runtests.php?test=10 I assume its a simple configuration and I just can't...

PHP property's scope overridden by passing as reference?

In PHP, if you return a reference to a protected/private property to a class outside the scope of the property does the reference override the scope? e.g. class foo { protected bar = array(); getBar() { return &bar; } } class foo2 { blip = new foo().getBar(); // i know this isn't php } Is this correct and is the arr...

Which PHP open source shopping cart solutions have features that benefit me as the web developer?

There are hundreds of shopping cart solutions available for every platform, and all hosting plans come with several already installed. As a developer I understand that most of these are fairly similar from a user perspective. But which ones are built with the developer in mind? For example, which ones have a decent API so that my custo...

How can one use multi threading in php applications

Is there a realistic way of implementing a multi-threaded model in php whether truly or just simulating it. Some time back it was suggested that you can force the operating system to load another instance of the php executable and handle other simultaneous processes. The problem with this is that when the php code finished executing the...

What is the best way to access a database from PHP?

Hi, When accessing a MySQL-database from PHP there seems to be several ways: Sprinkle the code with raw SQL-statements Use the VO-pattern from Java (e.g. DB_DataObjects from PEAR) DIY and write a script that auto-generates one PHP class per database table Apart from this I have also read about LINQ in .NET but have not s...

TYPO3: How do i render tt_content text elements in my own extensions?

I'm currently writing a TYPO3 extension which is configured with a list of tt_content UID's. These point to content elements of type "text" and i want to render them by my extension. Because of TYPO3s special way of transforming the text you enter in the rich text editing when it enters the database, and again transforming it when it is...

What are the best practices for avoid xss attacks in a PHP site

I have PHP configured so that magic quotes are on and register globals are off. I do my best to always call htmlentities() for anything I am outputing that is derived from user input. I also occasionally seach my database for common things used in xss attached such as... <script What else should I be doing and how can I make sure th...

Defining class methods in PHP

Is it possible in PHP (as it is in C++) to declare a class method OUTSIDE the class definition? ...

Multiple return values to indicate success/failure.

I'm kind of interested in getting some feedback about this technique I picked up from somewhere. I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit over the top for this sort of...

What is the best way to process all versions of MS Excel spreadsheets with php on a non-Windows machine.

I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007. The trouble is finding a technique to read ALL versions. More info: I am currently using php-ExcelReader. A script in a language other th...

PHP: Object oriented vs. MVC (CodeIgniter)

We are starting a new app and are debating the benefits of MVC (using CodeIgniter for PHP) vs. using object oriented PHP. I myself only really started using object oriented PHP, and do like it, but should I use that over codeigniter? I see benefits of both. ...

Is it possible to use .htaccess to send six digit number URLs to a script but handle all other invalid URLs as 404s?

Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404? For example: http://mywebsite.com/132483 would be sent to: http://mywebsite.com/scriptname.php?no=132483 but http://mywebsite.com/132483a or http://mywebsite.com/asdf would be handled as...

What is the best way to stop people hacking the PHP-based highscore table of a Flash game.

I'm talking about an action game with no upper score limit and no way to verify the score on the server by replaying moves etc. What I really need is the strongest encryption possible in Flash/PHP, and a way to prevent people calling the PHP page other than through my Flash file. I have tried some simple methods in the past of making m...