News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Edd Mann:
Reversing a Unicode String in PHP using UTF-16BE/LE
May 12, 2014 @ 10:55:00

Edd Mann looks at an issue in his latest post that caused him problems in a recent project, reversing a Unicode string with UTF-16BE/LE.

Last week I was bit by the Unicode encoding issue when trying to naively manipulate a user's input using PHP's built-in string functions. PHP simply assumes that all characters are a single byte (octet) and the provided functions use this assumption when processing a string. [...] You should be aware that in 'Western Europe' we commonly only use the basic ASCII character-set (consisting of 7 bytes). This makes the transition to the popular 'UTF-8' Unicode representation almost seamless, as the two map one-to-one. I wish to however, discuss how to reverse a Unicode string (UTF-8) using a combination of endianness magic and the 'strrev' function.

He provides two different approaches to the problem. The first he calls the "naive" approach because it corrupts characters needing more than the two-byte representation. His second solution, the "endianness" method, converts the string to big-endian first (UTF-16) and then back to UTF-8 for more correct handling.

0 comments voice your opinion now!
unicode string utf8 utf16 bigendian endian convert reverse string

Link: http://eddmann.com/posts/reversing-a-unicode-string-in-php-using-utf-16-be-le

PHPMaster.com:
Getting Started with Varnish
January 22, 2013 @ 10:37:17

On PHPMaster.com today there's a new tutorial that can help you increase the performance of your application relatively painlessly with the help of the Varnish proxy tool. The article helps you get started.

Varnish is a reverse proxy server; it sits in front of your web server and serves content from your server and no one else's. Reverse proxy servers are tightly coupled to the web server and can act on messages received from it. [...] Simply put, Varnish does one thing: serve web content super fast.

You'll need command line access to the machine (as well as permissions to install the software) but getting it installed is a simple "apt-get" away. There's a bit of configuration to set up to get it up and working, but it's only a few lines...and examples are included in the tutorial. They get into some of the more advanced configuration options too, like the time-to-live and changing the port it listens on. Varnish isn't just for PHP applications either - it can be used effectively for any kind of web application as it's just a proxy layer that sits on top and waits for requests.

0 comments voice your opinion now!
varnish tutorial application cache reverse proxy


Zend PHP Certification Blog:
PHP Sorting Functions
December 21, 2011 @ 11:39:06

On the "Zend PHP Certification" blog (study notes), there's sort and natsort).

In all the countless hours I've spent with php, I've maybe used three or four of these sorting functions. I really had no idea that there is a total of eleven functions used for sorting arrays. Anyway, I'm betting that it may be useful to have these memorized before I take the Zend PHP Certification Exam so here is a brief overview of each one.

He talks about the various flags that can be used in the sorting (for regular, numeric, string and locale-based string handling) and the parameters to call for normal sorting, "natural" sorting, reverse key sorting and others. You can find specifics on these array sorting methods in the PHP manual.

0 comments voice your opinion now!
sorting function array natural reverse key user


Matt Curry's Blog:
8 Ways to Speed Up CakePHP Apps
March 18, 2009 @ 10:23:26

Matt Curry has a new post to his blog listing a few ways that you can help get the most out of your CakePHP application's performance.

It's a not so well kept secret that CakePHP is slow. What isn't well know is that this is done by design. I could get in a lot of trouble by revealing this, but I'm willing to take that risk. [...] Every time you use one of the tips in this article it's one less gold chain on the neck of a Cake developer.

Here's his list of eight tips:

  • Set Debug to 0
  • Cache your slow queries/web service requests/whatever
  • View Caching
  • HTML Caching
  • APC (or some other opcode cache)
  • Persistent Models
  • Store The Persistent Cache in APC
  • Speed Up Reverse Routing

Some of the tips are CakePHP specific, but several of them (the caching) can be useful no matter what sort of application you're using - framework or not.

0 comments voice your opinion now!
eight speed caekphp framework cache apc model debug reverse routing


Debuggable Blog:
How To Save Half A Second On Every CakePHP Request
February 27, 2009 @ 12:09:51

CakePHP users might want to listen to this suggestion from Tim Koschutzki on the Debuggable blog - he wants to help you save a half second on each request.

There are several ways to improve the performance of your CakePHP application. [...] Any performance improvement that does not effect how data is retrieved, stored and cached is welcome. If it affects your entire site and not only parts of it, it's all the better.

The performance boost comes in the form of an update to CakePHP's reverse route lookup functionality. Normally a lookup would have to be parsed and resolved back to their original location. They figured a bit faster way around it though - breaking the reverse routing feature for the sake of speed. The code for the hack is included in the post.

0 comments voice your opinion now!
half second request performance cakephp framework reverse route lookup


Brian Snugg's Blog:
Reverse Proxy in PHP5
December 11, 2008 @ 11:14:03

Brian Snugg has two new posts relating to his script for a reverse proxy in PHP5. The first lays the foundation, the second makes some updates to make it a bit more efficient.

So I have been working on a little class to run a reverse proxy from PHP using cURL. I have extended this class for my own purposes (single-sign-on) to handle some special request parameters, but here it is. It has some warts, but it's a good starting point.

He creates the ProxyHandler class in the first post and in the second updates the script to pass a more correct version of the headers to the proxy server to get a better response back.

1 comment voice your opinion now!
reverse proxy php5 tutorial curl header


Nick Halstead's Blog:
Reverse Polish Notation in PHP
August 06, 2007 @ 16:56:00

As a follow up to a previous post where he discussed reverse polish notation, Nick Halstead has decided to split off the code he created for that previous post into a new, sleeker post without much of the explanation and heavy on the code.

My last post about back to basics covered reverse polish notation including a link to a RPN parser which I wrote to allow people to learn by example (best way in my opinion and in yours). The post got quite long and the PHP code was not really relevant to the subject so I have decided to include in this separate post instead.

There's two parts to the post - a pseudo-code explanation that an overview of how things work and the actual code, a block of code (in the 30 line area) that runs through each item and, based on a token, pushes the value into the array differently.

1 comment voice your opinion now!
polish notation reverse pseudocode polish notation reverse pseudocode


Brian Nelson's Blog:
Reverse Proxy in PHP5, Rev2
July 24, 2007 @ 08:46:00

Brian Nelson has posted a follow-up to his previous article on creating a reverse proxy with PHP5, this time expanding on the functionality of it and reworking some to increase performance.

It's gotten a bit more complex; The proxy handler didn't pass all the client headers to the proxy server. This caused problems with having the wrong client type, no Etag caching, cookie passing, etc. Here's the current rev, which solves a lot of these issues.

The complete code for the proxy class included in the post and a note was added that there's now a Google Code project that's been created for it (svn repository).

6 comments voice your opinion now!
reverse proxy class php5 handler client cookie reverse proxy class php5 handler client cookie


Brian Nelson's Blog:
Writing A Reverse Proxy in PHP5
July 18, 2007 @ 15:55:00

Brian Nelson submitted a link to a new class he's developed to fill a hole he hand and didn't see anything that would easily fill it - having a reverse proxy in PHP5.

So I have been working on a little class to run a reverse proxy from PHP using cURL. I have extended this class for my own purposes (single-sign-on) to handle some special request parameters, but here it is. It has some warts, but it's a good starting point. I would appreciate any pointers anyone has to offer.

His code uses the cURL functionality to set up a handler to push the requests through. Also included are an htaccess file and a two-line PHP example of how to use it to request a public site.

0 comments voice your opinion now!
curl php5 proxy reverse tutorial modproxy htaccess curl php5 proxy reverse tutorial modproxy htaccess


Alan Knowles' Blog:
Recovering encoded php files
March 20, 2006 @ 07:02:53

Alan Knowles has posted this post about some of the thinks that came from a previous post he did concerning a tool for encrypting PHP scripts. In this new post, however, he mentions something on the other side of the equation - a "PHP recovery tool".

Someone posted a comment on a post I did a while back about a product that was supposed to provide encryption on PHP scripts. (That blog post was probably my most controversial, as the author of the application send me an email asking me to contact his lawyers....)

The post this time was about another magic cure, php recovery, a new web site claiming (or appearing to) sell a product to recover php source code after it has been encrypted. Well, considering my last post, using plain old PHP methods, this is perfectly feasible. However they also claim to restore your code if it was encrypted with ioncube and Zend's encoders, which, not having tried them, but knowing the author of both products reasonably well, I have a few doubts about.

He mentions what most of the encoders on the market do to accomplish their protection (the translation into bytecodes) and what some of the potential problems with converting the bytecodes back to PHP would be. There's on piece of software he mentions ("Derick's VLD"), but that's only really useful because it dumps back the opcodes in a readable format.

0 comments voice your opinion now!
recovering encoded files bytecode reverse decompiler recovering encoded files bytecode reverse decompiler



Community Events





Don't see your event here?
Let us know!


community code podcast series developer api application laravel list release library unittest interview bugfix configure language wordpress introduction threedevsandamaybe install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework