RE: [PHP-DEV] enhance fget to accept a callback

2014-11-24 Thread Rowan Collins
On 23 November 2014 23:36:30 GMT, Bill Salak wrote: >The callback would be given the string as returned by fgets today. The >functional equivalent to fgetjson today is handled by something like >$handle = fopen(~some file~, 'r'); >while (($data = fgets($handle)) !== FALSE) { >$data = json_dec

Re: [PHP-DEV] enhance fget to accept a callback

2014-11-24 Thread Thomas Hruska
On 11/23/2014 2:47 PM, Rowan Collins wrote: For JSON, newlines aren't the delimiter you want, but with nested structures, I'm not sure how you'd parse a partial structure anyway. Are there JSON equivalents of SAX (event-based) parsers? If JSON is encoded into another format, newlines can be a

Re: [PHP-DEV] enhance fget to accept a callback

2014-11-23 Thread Tjerk Meesters
Hi! > On 24 Nov 2014, at 02:39, Bill Salak wrote: > > Hi list, > > > > I'm considering writing an RFC to add a 3rd parameter to fgets which accepts > a user defined function. If we had this today we wouldn't need fgetcsv with > the added benefit of fgetcsv style support for data packaging for

RE: [PHP-DEV] enhance fget to accept a callback

2014-11-23 Thread Bill Salak
>Hi list, > >I'm considering writing an RFC to add a 3rd parameter to fgets which >accepts a user defined function. If we had this today we wouldn't need >fgetcsv with the added benefit of fgetcsv style support for data >packaging formats we would otherwise create more 1 off functions for. >Fo

Re: [PHP-DEV] enhance fget to accept a callback

2014-11-23 Thread Rowan Collins
On 23 November 2014 18:39:18 GMT, Bill Salak wrote: >Hi list, > > > >I'm considering writing an RFC to add a 3rd parameter to fgets which >accepts >a user defined function. If we had this today we wouldn't need fgetcsv >with >the added benefit of fgetcsv style support for data packaging formats >

[PHP-DEV] enhance fget to accept a callback

2014-11-23 Thread Bill Salak
Hi list, I'm considering writing an RFC to add a 3rd parameter to fgets which accepts a user defined function. If we had this today we wouldn't need fgetcsv with the added benefit of fgetcsv style support for data packaging formats we would otherwise create more 1 off functions for. For exampl