php

PHP Script Compression/"Compilation" Tools

Are there any more generic tools that can "compile" or basically merge multiple PHP files into a single file based on includes and autoloading classes? I'm thinking of something similar to Doctrine's compiling functionality or the compiling that many of the major JS frameworks do for "production" sites to lighten the file size and improv...

WSDL URL for a WCF Service (basicHttpBinding) hosted inside a Windows Service

I am hosting a WCF service in a Windows Service on one of our servers. After making it work in basicHttpBinding and building a test client in .NET (which finally worked) I went along and try to access it from PHP using the SoapClient class. The final consumer will be a PHP site so I need to make it consumable in PHP. I got stumped when ...

Order dates by upcoming

So I build an array of various dates. Birthdays, anniversaries, and holidays. I'd like to order the array by which one is happening next, essentially sort October to September (wrapping to next year) so if my array is $a = ([0]=>"1980-04-14", [1]=>"2007-06-08", [2]=>"2008-12-25", [3]=>"1978-11-03") I'd like to sort it so it is ar...

PEAR Channels - Setting up your own?

I am looking for instructions on how to setup a PEAR channel for our project so that we can deploy it with the pear installer. I have Googled for a while and cannot find any straightforward information. I followed this tutorial for a while, but I am having a hell of a time getting this to work. Does anyone know how to do this? Is there a...

Pass a PHP string to a Javascript variable (including escaping newlines)

What is the easiest way to encode a PHP string for output to a Javascript variable? I have a PHP string which includes quotes and newlines. I need the contents of this string to be put into a Javascript variable. Normally, I would just construct my Javascript in a PHP file, ala: <script> var myvar = "<?php echo $myVarValue;?>"; </s...

Is it possible to connect PHP to SQL Server Compact Edition?

Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver? ...

Can you get a Windows (AD) username in PHP?

I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible? ...

php mode for emacs

I'm having trouble with my php code not indenting correctly... I would like my code to look like this if (foo) { print "i am indented"; } but it always looks like this: if (foo) { print "i am not indented correctly"; } I tired googling for similar things and tried adding the following to my .emacs, but it didn't work a...

Populating a PHP array: check for index first?

If I'm deep in a nest of loops I'm wondering which of these is more efficient: if (!isset($array[$key])) $array[$key] = $val; or $array[$key] = $val; The second form is much more desirable as far as readable code goes. In reality the names are longer and the array is multidimensional. So the first form ends up looking pretty gnarly...

Does anyone know of a php framework that would handle progressive enhancement for Flash/Flex content?

Ok, I'm using the term "Progressive Enhancement" kind of loosely here but basically I have a Flash-based website that supports deep linking and loads content dynamically - what I'd like to do is provide alternate content (text) for those either not having Flash and for search engine bots. So, for a user with flash they would navigate to:...

Parallel HTTP requests in PHP using PECL HTTP classes [Answer: HttpRequestPool class]

The HttpRequestPool class provides a solution. Many thanks to those who pointed this out. A brief tutorial can be found at: http://www.phptutorial.info/?HttpRequestPool-construct Problem I'd like to make concurrent/parallel/simultaneous HTTP requests in PHP. I'd like to avoid consecutive requests as: a set of requests will take...

unexpected T_CONCAT_EQUAL

Hi All, I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form: $arg1 .= "arg2".$arg3."arg4"; I'm using PHP5. I could simply go an do the following: $arg1 = $arg1."arg2".$arg3."arg4"; but I'd like to know whats going wrong in the first place. Any ideas? Thanks, sweeney ...

PHP DateTime microseconds always returns 0

Hi, this code always returns 0 in PHP 5.2.5 for microseconds: <?php $dt = new DateTime(); echo $dt->format("Y-m-d\TH:i:s.u") . "\n"; ?> Output: [root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ...

Warning when using mysql_fetch_assoc in PHP

When I run my php page, I get this error and do not know what's wrong, can anyone help? If anyone needs more infomation, I'll post the whole code. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in H:\Program Files\EasyPHP 2.0b1\www\test\info.php on line 16 <?PHP $user_name = "root"; $passw...

Object-relational mapping: What's the best way to implement getters?

What should happen when I call $user->get_email_address()? Option 1: Pull the email address from the database on demand public function get_email_address() { if (!$this->email_address) { $this->read_from_database('email_address'); } return $this->email_address; } Option 2: Pull the email address (and the other User a...

What's the best process / app for automated deployment of PHP apps?

There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on Capistrano, but am curious what else is out there. Aside from the obvious reasons, I'm also looking to add some scripting so that the SVN rev number gets added in there ...

Mock testing and PHP's magic __get method

I'm having problems when trying to mock objects with __get and __set methods (using simpletest). Writing mock responses for __get doesn't smell right - the tests seem too tightly tied to implementation. Any recommendations for testing, or should I just avoid the magic methods completely ? ...

In PHP will a session be created if a browser is not used

I have an API that is dependent on certain state information between requests. As an easy first version of the code, I am simply using PHP session's to store the state information instead of something more advanced (APC, memcache, DB). Throughout my initial testing in a web browser, everything worked perfectly. However, it seems that whe...

Good inflection library for PHP?

I'm looking for a good inflection (or well, a library that can turn plural into singular and vice verse - which a kind of inflection) library for PHP, it could be a part of some current framework or a stand alone library the only requirement I have is that it's compatible with the MIT license. ...

best IDE / Editor for PHP

Possible Duplicate: Any good PHP IDE, preferably free or cheap? I want to know if there's an IDE for PHP like Visual Web Developer for .net? Thanks mates ...