<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 12 Feb 2012 17:59:53 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DevShed: Handling File Data with PHP (Reading & Seeking)]]></title>
      <guid>http://www.phpdeveloper.org/news/17196</guid>
      <link>http://www.phpdeveloper.org/news/17196</link>
      <description><![CDATA[<p>
DevShed has posted the fifth part of their "handling files in PHP" tutorial series today (excerpted from the book "Beginning PHP and PostgreSQL 8: From Novice to Professional") with a focus on <a href="http://www.devshed.com/c/a/PHP/Handling-File-Data-with-PHP/">read from multiple places in a file</a> to get to different data.
</p>
<blockquote>
In this fifth part of an eight-part series on working with file and operating systems with PHP, you'll learn how to read data from a file and move the file pointer. 
</blockquote>
<p>
Example code is included showing how to use the <a href="http://php.net/file">file</a>, <a href="http://php.net/file_get_contents">file_get_contents</a>, <a href="http://php.net/fgetc">fgetc</a>, <a href="http://php.net/fgetcsv">fgetcsv</a>, <a href="http://php.net/readfile">readfile</a> and <a href="http://php.net/fscanf">fscanf</a> (among several others). Also included is code showing how to use the <a href="http://php.net/fseek">fseek</a> method to move around in a file.
</p>]]></description>
      <pubDate>Thu, 01 Dec 2011 10:09:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Checking the performance reading arrays with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16724</guid>
      <link>http://www.phpdeveloper.org/news/16724</link>
      <description><![CDATA[<p>
While admitting that micro-optimizations aren't usually worth the time that's taken to worry about them, <i>Gonzalo Ayuso</i> has thrown together some <a href="http://gonzalo123.wordpress.com/2011/08/15/checking-the-performance-reading-arrays-with-php/">array read benchmarks</a> to show the difference, if any, in where array values are fetched.
</p>
<blockquote>
Normally our code is coded once and executed thousands of times, and we must keep in mind that CPU time many times means money. We need to balance it (as always). But, WTH. I like micro-optimizations, and here comes another one: Checking the access to arrays with PHP.
</blockquote>
<p>
He sets up three different options and tests the memory consumption and run time for each:
</p>
<ul>
<li>Referencing a value from a large array outside a for loop
<li>Referencing a value from a large array inside a for loop
<li>Echoing out the value from a large array inside a for loop
</ul>
<p>
Not surprisingly, all three approaches yield just about the same results. It probably has more to do with the size of the large array than how it's accessed. The fetch outside the for loop did come in slightly under the others, but not enough to worry about it.
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 11:46:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Read the version of a PDF in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16621</guid>
      <link>http://www.phpdeveloper.org/news/16621</link>
      <description><![CDATA[<p>
<i>Sameer Borate</i> has a quick post to his blog today with some code that lets you <a href="http://www.codediesel.com/php/read-the-version-of-a-pdf-in-php/">read the version of a PDF document</a> programmatically without a dependency on a PDF extension or library being installed.
</p>
<blockquote>
The following [example] is a very short code to read the version number of a PDF document using PHP. I needed this recently during a PDF processing app developed in PHP. As Adobe uses different compression methods in various versions, it becomes necessary to be able to identify the version of the PDF under work.
</blockquote>
<p>
<a href="http://www.codediesel.com/php/read-the-version-of-a-pdf-in-php/">The code</a> opens the file with a <a href="http://php.net/fopen">fopen</a> and parses a certain line for the major and minor version. The PDF extension for PHP can do something similar with the <a href="http://www.php.net/manual/en/function.pdf-get-value.php">pdf_get_value</a> function passing in either "major" or "minor" as the second parameter.
</p>]]></description>
      <pubDate>Fri, 22 Jul 2011 09:54:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Howto Send/Read SMSs using a GSM modem, AT+ commands and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16077</guid>
      <link>http://www.phpdeveloper.org/news/16077</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today showing how you can <a href="http://gonzalo123.wordpress.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/">send and read SMS messages</a> with PHP through a GSM modem. The AT+ commands they use can be sent via a serial (or serial-to-usb) interface directly from your application to a local device. He includes both code and some sample AT commands to get the ball rolling.
</p>
<blockquote>
GSM modems are similar than normal modems. They've got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That's means we can send (and read) SMSs and create scripts to perform those operations. [...] The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface). 
</blockquote>
<p>
His base SMS class provides open, close and read methods that talk with the device set in a child class (in this case "/dev/ttySO"). The sendSMS method is defined to take in the number to send to and the message. The AT command examples show how to send the SMS message, read all of the messages waiting and delete an SMS from the device. You can get the full code <a href="https://github.com/gonzalo123/gam-sms">from github</a>.
</p>]]></description>
      <pubDate>Tue, 22 Mar 2011 08:15:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SpeckBoy.com: Getting Started with CRUD In PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15929</guid>
      <link>http://www.phpdeveloper.org/news/15929</link>
      <description><![CDATA[<p>
On SpeckBoy.com there's <a href="http://speckyboy.com/2011/02/17/getting-started-with-crud-in-php/">a new tutorial</a> posted that introduces you to the concept of CRUD - Create, Read, Update, Delete - in the database interface for your application. Technically CRUD can be applied to any sort of data store, but they chose to go with a MySQL-based example.
</p>
<blockquote>
It has become a common necessity for website owners to collect data and manage it properly. Creating a MySQL CRUD class allows you to conveniently create, read, update and delete entries for any of your projects, indifferent of how the database is devised. CRUD allows us to generate pages to list and edit database records.
So, in this tutorial I will show you how to build a simple CRUD web app, that will empower you with the basic functions of database management.
</blockquote>
<p>
They briefly walk you through the setup of a <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> server to use as a base and give you the settings needed to create a simple users table. The rest of the post is the code you'll need to make the connection from your PHP script, insert data into the table, update them, remove the rows and display their contents. They've wrapped it all up in a single "index.php" file to make it simpler.
</p>]]></description>
      <pubDate>Fri, 18 Feb 2011 12:10:10 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Maarten Balliauw's Blog: PHPPowerPoint 0.1.0 (CTP1) released!]]></title>
      <guid>http://www.phpdeveloper.org/news/12434</guid>
      <link>http://www.phpdeveloper.org/news/12434</link>
      <description><![CDATA[<p>
<i>Maarten Balliauw</i> has <a href="http://blog.maartenballiauw.be/post/2009/04/27/PHPPowerPoint-010-(CTP1)-released!.aspx">posted about the release</a> of a new bit of software to help you read and write from/to Microsoft PowerPoint files - <a href="http://www.phppowerpoint.net/">PHPPowerPoint</a> (0.1.0 CTP1).
</p>
<blockquote>
Just like with PHPExcel, <a href="http://www.phppowerpoint.net/">PHPPowerPoint</a> can be used to generate PPTX files from a PHP application. This can be done by creating an in-memory presentation that consists of slides and different shapes, which can then be written to disk using a writer (of which there's currently only one for PowerPoint 2007).
</blockquote>
<p>
Some example code is included that creates a single-slide slideshow with the PHPPowerpoint logo and the text "Thank you for using PHPPowerpoint". There's plenty of configuration options and you can place things in the slides down to the pixel. You can try out this initial release <a href="http://www.phppowerpoint.net/">here</a>.
</p>]]></description>
      <pubDate>Thu, 30 Apr 2009 11:16:53 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Paul Gregg's Blog: "tail -# file" in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/12402</guid>
      <link>http://www.phpdeveloper.org/news/12402</link>
      <description><![CDATA[<p>
<i>Paul Gregg</i> has <a href="http://pgregg.com/blog/2009/04/tail---file-in-php.html">written up an example</a> of what he calls "tail -# file for PHP" (starting from the end of file and moving backwards a given number of lines).
</p>
<blockquote>
Here I will demonstrate a fairly tuned method of seeking to the end of the file and stepping back to read sufficient lines to the end of the file. If insufficient lines are returned, it incrementally looks back further in the file until it either can look no further, or sufficient lines are returned.
</blockquote>
<p>
His script meets two goals - reading enough lines in for the request and keeping those lines to a minimum. His code grabs the size of the file and opens the file as a resource to fseek to a certain point and read in the lines from the defined start to finish and push them into an array. You can see the <a href="http://pgregg.com/projects/php/code/tail-10.phps">source here</a> and a <a href="http://pgregg.com/projects/php/code/tail-10.php">sample execution here</a>.
</p>]]></description>
      <pubDate>Fri, 24 Apr 2009 12:02:42 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPro.org: Read Line From File (stream_get_line)]]></title>
      <guid>http://www.phpdeveloper.org/news/12392</guid>
      <link>http://www.phpdeveloper.org/news/12392</link>
      <description><![CDATA[<p>
The PHPro.org website has <a href="http://www.phpro.org/examples/Read-Line-From-File.html">a quick new tutorial</a> about a method (using streams) to get the information from a certain line of a file.
</p>
<blockquote>
Reading files in PHP can be a tricky business if not handled correctly. Most often when confronted with reading a line from, the nearest tool to hand is the file() function. The problem with using the file() function is that it reads the whole file into an array, and thus, into memory [...] A better, and more efficient way is to loop through the file stream using the stream_get_line() function. Care still needs to be taken to clear the buffer on each iteration, or the same problem could potentially arise as with the file() method. 
</blockquote>
<p>
The code calls <a href="http://php.net/fopen">fopen</a> on the file and, while it's not the end of the file, uses the <a href="http://php.net/stream_get_line">stream_get_line</a> function to grab things a line at a time. This saves you from having to read in the entire file (like with a <a href="http://php.net/file_get_contents">file_get_contents</a> or <a href="http://php.net/file">file</a> - especially good for large files.
</p>]]></description>
      <pubDate>Thu, 23 Apr 2009 09:36:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[TotalPHP.com: How to Read an RSS Feed with PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/12387</guid>
      <link>http://www.phpdeveloper.org/news/12387</link>
      <description><![CDATA[<p>
New on the TotalPHP blog today is <a href="http://www.total-php.com/article/19/how-to-read-an-rss-feed-with-php-5/">this article</a> talking about reading RSS feeds with PHP (more specifically with <a href="http://php.net/simplexml">SimpleXML</a>).
</p>
<blockquote>
PHP 5's ability to read XML files is fantastically easy to use. In the past it was possible but it required quite a bit of long winded code to get any where. PHP 5's SimpleXmlElement function makes working with XML a breeze, and with much less code too! 
</blockquote>
<p>
They include a script as an example - five lines to completely parse and pull the title and link information out of the remote RSS file. The example creates a SimpleXML object using the feed's URL and makes each element inside accessible as an object (that can be looped through and properties can be checked on).
</p>]]></description>
      <pubDate>Wed, 22 Apr 2009 11:15:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Reading Access Databases with PHP and PECL]]></title>
      <guid>http://www.phpdeveloper.org/news/11459</guid>
      <link>http://www.phpdeveloper.org/news/11459</link>
      <description><![CDATA[<p>
The Zend Developer Zone has a <a href="http://devzone.zend.com/article/4065-Reading-Access-Databases-with-PHP-and-PECL">new tutorial</a> posted today from <i>Vikram Vaswani</i> about accessing a database with the help of the MDBTools PECL extension to read from a Microsoft Access datbase.
</p>
<blockquote>
In this article, I'll introduce you to PHP's MDBTools extension, which provides an API to programmatically read data from Microsoft Access database files. If your project involves working with such files, extracting database records either for calculations or for conversion to other formats, you'll find this extension invaluable.
</blockquote>
He <A href="http://devzone.zend.com/article/4065-Reading-Access-Databases-with-PHP-and-PECL">steps through</a> the installation of the extension (via the pecl command line tool) and some sample code that grabs the tables, all of their attributes and how to select the data out from them.
</p>]]></description>
      <pubDate>Wed, 26 Nov 2008 13:26:12 -0600</pubDate>
    </item>
  </channel>
</rss>

