PHP performance
What can I do to increase the performance/speed of my PHP scripts without installing software on my servers? ...
What can I do to increase the performance/speed of my PHP scripts without installing software on my servers? ...
In a project that I'm about to wrap up, I've written and implemented an object-relational mapping solution for PHP. Before the doubters and dreamers cry out "how on earth?", relax -- I haven't found a way to make late static binding work -- I'm just working around it in the best way that I possibly can. Anyway, I'm not currently using p...
What's the most efficient way to resize large images in PHP? I'm currently using the GD function imagecopyresampled to take high resolution images, and cleanly resize them down to a size for web viewing (roughly 700 pixels wide by 700 pixels tall). This works great on small (under 2 MB) photos and the entire resize operation takes less...
This is driving me crazy. I have this one php file on a test server at work which does not work.. I kept deleting stuff from it till it became <? print 'Hello'; ?> it outputs Hello if I create a new file and copy / paste the same script to it it works! Why does this one file give me the strange characters all the time? ...
This is a nasty one for me... I'm a PHP guy working in Java on a JSP project. I know how to do what I'm attempting through too much code and a complete lack of finesse. I'd prefer to do it RIGHT. :) Here is the situation: I'm writing a small display to show customers what days they can water their lawns based on their watering group...
i'm looking for good/working/simple to use php code for parsing raw email into parts. i've written a couple of brute force solutions, but everytime, one small change/header/space/something comes along and my whole parser fails and the project falls apart. and before i get pointed at PEAR/PECL, i need actual code. my host has some screw...
Does anybody have experience working with PHP accelerators such as MMCache or Zend Accelerator? I'd like to know if using either of these makes PHP comparable to faster web-technologies. Also, are there trade offs for using these? ...
I want to define something like this in php: $EL = "\n<br />\n"; and then use that variable as an "endline" marker all over my site, like this: echo "Blah blah blah{$EL}"; How do I define $EL once (in only 1 file), include it on every page on my site, and not have to reference it using the (strangely backwards) "global $EL;" statem...
in php, i often need to map a variable using an array ... but i can not seem to be able to do this in a one liner. c.f. example: // the following results in an error: echo array('a','b','c')[$key]; // this works, using an unnecessary variable: $variable = array('a','b','c'); echo $variable[$key]; this is a minor problem, but it keeps...
I am thinking of using a PHP framework called Code Igniter. One of the things I am interested in about it is that it's fast, I have however no way to find out how fast and would rather not simply take the word of their website for it. Does anybody know how I can determine it's speed or tell me of a site that can? Thank you. ...
In our place we're split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever moving to another RDBMS. I prefer PDO for the single reason that it allows named parameters for prepared statements, and as far as I am a...
(assume php5) consider <?php $foo = 'some words'; //case 1 print "these are $foo"; //case 2 print "these are {$foo}"; //case 3 print 'these are ' . $foo; Is there much of a difference between 1 and 2? If not, what about between 1/2 and 3? ...
I am used to writing C# Windows application. However I have some free hosted PHP web space that I would like to make use of. I have a basic understanding of PHP but have never used it's object oriented capabilities. Is there an easy way to convert C# classes to PHP classes or is it just not possible to write a fully object oriented appl...
I've seen it mentioned in many blogs around the net, but I believe it shoud be discussed here. What can we do when we have an MVC framework (I am interested in ZEND) in PHP but our host does not provide mod_rewrite? Are there any "short-cuts"? Can we transfer control in any way (so that a mapping may occur between pages)? Any ideas? Than...
I've been thinking about switching from my current PhpEd / UltraEdit combination to using this VS.PHP plugin that I just found a few days ago. The problem is that I don't have much free time, so I'm hoping that there are other people who can give me an opinion on it, especially concerning the remote debugging capabilities since I always ...
Say you have a shipment. It needs to go from point A to point B, point B to point C and finally point C to point D. You need it to get there in five days for the least amount of money possible. There are three possible shippers for each leg, each with their own different time and cost for each leg: Array ( [leg0] => Array ( ...
What's the best practice for making sure that certain ajax calls to certain pages are only accepted from authenticated users? For example: Let's say that I have a main page called blog.php (I know, creativity abounds). Let's also say that there is a page called delete.php which looks for the parameter post_id and then deletes some ent...
The "Question": Is there a way in PHP to overwrite a method declared by one interface in an interface extending that interface? The "Example": I'm probably doing something wrong, but here is what I have: interface iVendor{ public function __construct($vendors_no = null); public function getName(); public function getVendors...
So I'm working on a project that will allow users to enter poker hand histories from sites like PokerStars and then display the hand to them. It seems that regex would be a great tool for this, however I rank my regex knowledge at "slim to none". So I'm using PHP and looping through this block of text line by line and on lines like thi...
I read this PHP RegEx page, but either I'm missing something, misreading something, or it doesn't work the way they say. I'm guessing it's one of the first two. $str = preg_replace("([|]\d*)", "\1;", $str); ...