News Feed
Sections




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

Evert Pot's Blog:
Creating Streams from Strings in PHP
February 02, 2009 @ 12:58:50

Evert Pot has a quick post on a handy little topic - making streams from strings with PHP (see some of it in action on Davey Shafik's blog).

There are situations where a string instead needs to be used, and for these purposes the data: stream wrapper is used. Initially I thought it was only possible to encode the actual string in base64, which I didn't like because of the added footprint. [...] Quickly checking out the rfc, it turns out that ';base64' can be omitted to just pass along the raw data, which makes a lot more sense in the context of PHP.

His example takes in an example string and pushes it back out the other side after base64 encoding and decoding it. Davey Shafik found a use for it in avoiding an eval call.

0 comments voice your opinion now!
stream string tutorial base64 streamgetcontents eval


blog comments powered by Disqus

Similar Posts

Arnold Daniels' Blog: How I PHP: The Output Handler

C7Y: Late Static Binding: a practical example

Michael Nitschinger: Caching Doctrine Entities with Couchbase

PHPMaster.com: Implementing a Unit of Work - Handling Domain Objects through a Transactional Model

Benjamin Schneider's Blog: Use PHP's Tidy extension to validate your (X)HTML markup


Community Events





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


package community composer interview voicesoftheelephpant install laravel series tool version language symfony introduction podcast update library opinion release security framework

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