PHP's explode function returns an array of strings split on some provided substring. It will return empty strings like this:
var_dump(explode('/', '1/2//3/'));
array(5) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(0) ""
[3]=>
string(1) "3"
[4]=>
string(0) ""
}
Is there some different function or option or...
I know next to nothing when it comes to the how and why of https connections. Obviously, when I'm transmitting secure data like passwords or especially credit card information, https is a critical tool. What do I need to know about it, though? What are the most common mistakes you see developers making when they implement it in their ...
I have a pdf file of a logo, about 1"x2" in dimension. Can anybody provide the code snippet to import that PDF logo into another PDF file using the Zend_PDF API's?
Ideally, I'd like to be able to place it like the PNG, TIFF or JPG objects with the Zend_Pdf_Image object.
In other words, I want to be able to place the little 1x2" pdf...
What is the nest PHP thumbnailer/resizer class that preferably works on most shared hosts?
Clarification: I'm looking for a PHP class/wrapper (eg. phpThumb(), Asido), so I don't have to run GD or ImageMagick functions directly. I'm specifically looking for resizing and framing functions.
...
I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting & setting.
For example (where Foo is a PHP class of my making):
$foo = new Foo();
$foo['fooKey'] = 'foo value';
echo $foo['fooKey'];
I know that PHP has the _get and _set magic methods but those don't let you use array notat...
I'm trying to run PHP from the command line under Windows XP.
That works, except for the fact that I am not able to provide parameters to my PHP script.
My test case:
echo "param = ".$param."\n";
var_dump($argv);
I want to call this as:
php.exe -f test.php -- param=test
But I never get the script to accept my parameter.
The r...
I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers.
I would love to stay with PHP for this, but I am open to Python or Perl as well.
Any ideas would be greatly appreciated.
...
Is it possible to use OpenID for both .NET web sites and PHP websites (Apache/Linux)? I have a manager that wants single sign-on for access to any/all web sites, regardless of which web server hosts a web site. I create .NET web apps and the PHP web sites/apps are done by another programmer. How would I go about using OpenID for a .NE...
I'm a longtime Java programmer working on a PHP project, and I'm trying to get PHPUnit up and working. When unit testing in Java, it's common to put test case classes and regular classes into separate directories, like this -
/src
MyClass.java
/test
MyClassTest.java
and so on.
When unit testing with PHPUnit, is it common to foll...
I would like to know how to write PHPUnit tests with Zend_Test and in general with PHP.
...
I was asked this question in a job interview. The interviewer and I disagreed on what the correct answer was. I'm wondering if anyone has any data on this.
Update: I should have mentioned that the use of shuffle() was strictly forbidden... sorry.
...
one of the most frequent requests i get is to create XY report for YZ App. This apps are normally built on php, so far i have manually created most of this reports, and while I enjoy the freedom of building it like i want, it usually becomes pretty tedious to calculate subtotals,averages, exporting to different formats etc.
What solutio...
I need to rotate an image at 12 midnight every day from a group of 5-10 images. How can I go about doing this with javascript or jquery or even php?
...
I need to flip an image so that a character faces in the right direction. This needs to be done "on the fly' as they say.
The issue I am having is that with Gif images, I seem to lose the transparency. (The background goes white)
Below is the code: (Alternatively someone could send me to a good example)
$img = imagecreatefromgif("./u...
For a particular project I have, no server side code is allowed. How can I create the web site in php (with includes, conditionals, etc) and then have that converted into a static html site that I can give to the client?
Update: Thanks to everyone who suggested wget. That's what I used. I should have specified that I was on a PC, so I g...
I've gotten comfy with SVN, and now I need a way to deploy my code to staging or live servers more easily. I'd also like some method for putting build info in the footer of this site to aid in testing. Site is PHP/MySQL.
...
I have a bunch of legacy documents that are HTML-like. As in, they look like HTML, but have additional made up tags that aren't a part of HTML
<strong>This is an example of a <pseud-template>fake tag</pseud-template></strong>
I need to parse these files. PHP is the only only tool available. The documents don't come close to being we...
I find myself doing some relatively advanced stuff with memcached in PHP. It's becoming a mental struggle to think about and resolve race conditions and concurrency issues caused by the lock-free nature of the cache.
PHP seems pretty poor in tools when it comes to concurrency (threads, anyone?), so I wonder if there are any solutions ou...
I've built one, but I'm convinced it's wrong.
I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records).
Is there a better way?
Many thanks.
I code in PHP with MySQL
...
Can somebody provide an example of how to use the Zend_Pdf_Page::drawContentStream() method from the Zend_Pdf API's?
...