Re: [PHP] Convert Hours to Decimal
On 17 October 2011 22:57, Don Wieland d...@dwdataconcepts.com wrote: select timediff(cast(out_1 as time), cast(in_1 as time)) tHours FROM lm_tc_trans WHERE tc_trans_id = '42' Can you try ... SELECT CAST ( TIMEDIFF ( CAST(Out_1 AS Time), CAST(In_1 AS Time) ) AS Decimal(5,2) ) tHours FROM lm_tc_trans WHERE tc_trans_id = '42' Basically, CAST the result back to a decimal(5,2) -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert Hours to Decimal
Hey Tim, I got a select string: select timediff(cast(out_1 as time), cast(in_1 as time)) tHours FROM lm_tc_trans WHERE tc_trans_id = '42' result = 08:45:00 How do i convert that to a FLOAT (5,2) = 8.75 or result = 08:15:00 How do i convert that to a FLOAT (5,2) = 8.25 Don Wieland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
Outside the box a bit, but is there perhaps a web-service that does this, something like http://www.thumbalizr.com/ but for PDF files. As long as you had curl or something you would be GTG at that point. -Sean- On Thu, Jun 16, 2011 at 1:48 PM, Brian Dunning br...@briandunning.com wrote: I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
There's an interesting discussion on this page. http://www.linuxquestions.org/questions/linux-software-2/pdf-to-png-converter-57142/ Cheers, Curtis Sean Kenny wrote: Outside the box a bit, but is there perhaps a web-service that does this, something like http://www.thumbalizr.com/ but for PDF files. As long as you had curl or something you would be GTG at that point. -Sean- On Thu, Jun 16, 2011 at 1:48 PM, Brian Dunning br...@briandunning.com wrote: I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On 15 June 2011 00:00, Tamara Temple tamouse.li...@gmail.com wrote: On Jun 14, 2011, at 5:48 PM, Brian Dunning wrote: The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. Well there's one on me... I didn't even *know* you could covert a text PDF to a PNG image The more you know rainbow/ It is just a case of rasterizing the PDF to a display and encoding it to an image (or raw). Admittedly, all the PDFs I work with are essentially images as the source is a fax server. I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. Once in a PNG file, I use commandline IMagick to add a tag to the top and the bottom of the fax (the bottom tag is rotated 180 degrees). The tag can then be read regardless of the orientation of the fax when the user scanned it. Processing several thousand faxes a day. For 6 years or so. A LOT of paper saved at our end. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert a PDF to a PNG?
My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On 14 June 2011 21:37, Brian Dunning br...@briandunning.com wrote: My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. I do that using an external tool pdf2png. For me, I use Cygwin. Works very well for me. Also splits the PDF into single page per PNG. I can then process the PNG files in other ways. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The server does not have that software installed either. :-( On Jun 14, 2011, at 1:53 PM, Richard Quadling wrote: I do that using an external tool pdf2png. For me, I use Cygwin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On 14 June 2011 22:30, Brian Dunning br...@briandunning.com wrote: The server does not have that software installed either. :-( On Jun 14, 2011, at 1:53 PM, Richard Quadling wrote: I do that using an external tool pdf2png. For me, I use Cygwin. Can you see what pdf tools ARE installed? Are the PDFs text based or just images in a PDF file (mine are both), but for just images, you _COULD_ extract the image data manually. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On Jun 14, 2011, at 3:37 PM, Brian Dunning wrote: My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. Could you install a copy of ImageMagick in a user/hosted directory? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert a PDF to a PNG?
Will they allow you to recompile PHP http://www.php.net/manual/en/imagick.installation.php Richard L. Buskirk -Original Message- From: Tamara Temple [mailto:tamouse.li...@gmail.com] Sent: Tuesday, June 14, 2011 6:18 PM To: PHP-General List Subject: Re: [PHP] Convert a PDF to a PNG? On Jun 14, 2011, at 3:37 PM, Brian Dunning wrote: My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. Could you install a copy of ImageMagick in a user/hosted directory? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. On Jun 14, 2011, at 2:36 PM, Richard Quadling wrote: Can you see what pdf tools ARE installed? Are the PDFs text based or just images in a PDF file (mine are both), but for just images, you _COULD_ extract the image data manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On Jun 14, 2011, at 5:48 PM, Brian Dunning wrote: The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. Well there's one on me... I didn't even *know* you could covert a text PDF to a PNG image The more you know rainbow/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert hex string to hex value?
On Fri, Oct 22, 2010 at 1:05 AM, Micky Hulse mickyhulse.li...@gmail.comwrote: Hi, I must be tired because I can't figure this out... I am sure it is something obvious. I need to pass a hex value to a method, but I can't figure out how to convert a hex string to a hex value. For exmaple: $base = '96989b' my_method('0x' . $base) The above does not work with my_method(). my_method(0x96989b) The above works without any problems. Any tips? Many thanks in advance! Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Micky, I suspect the issue is the conversion from string to a number in your example: http://www.php.net/manual/kr/language.types.string.php#language.types.string.conversion In your second example, you're directly inputing a hex number, so there's no issue. Hope you get some rest :) Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
Re: [PHP] Convert hex string to hex value?
Hi Adam! Many thanks for you quick reply and for the help. :) On Thu, Oct 21, 2010 at 11:31 PM, Adam Richardson In your second example, you're directly inputing a hex number, so there's no issue. Interesting... I wish I could just input the hex directly, unfortunately I don't have that option. :( Still trying to figure out how I can take this: $base = '96989b'; my_method('0x' . $base); ... and make my method think (for a lack of a better word) it is this: my_method(0x96989b); Hmmm, I wonder if I am going about this all wrong. Hope you get some rest :) Thanks Adam! I really appreciate your help! Have a nice night. Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert hex string to hex value?
On Thu, Oct 21, 2010 at 11:45 PM, Micky Hulse rgmi...@gmail.com wrote: Hmmm, I wonder if I am going about this all wrong. OMG, too easy: my_method(hexdec('0x' . $base)) How did I miss that!?! I could swear I tried that earlier. Sorry to bug ya'll! Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert hex string to hex value?
Hi, I must be tired because I can't figure this out... I am sure it is something obvious. I need to pass a hex value to a method, but I can't figure out how to convert a hex string to a hex value. For exmaple: $base = '96989b' my_method('0x' . $base) The above does not work with my_method(). my_method(0x96989b) The above works without any problems. Any tips? Many thanks in advance! Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert excel time to date time
On 17 July 2010 12:47, Mohd Shakir bin Zakaria mohdsha...@gmail.com wrote: Hi, I've been trying to convert this excel date to the date time format, but only managed to get it up to the seconds; The following code; # $data=39604.62164; date(Y-m-d,mktime(0,0,0,1,$data-1,1900)); # will give this output 2008-06-05 changing it to date(H-i-s,mktime(0,0,0,1,$data-1,1900)); will only give 00-00-00 The output I'm looking for is like this one; 2008-06-05 14:55:09 Any idea? ?php function xls2tstamp($date) { return ((($date 25568) ? $date : 25569) * 86400) - ((70 * 365 + 19) * 86400); } echo date('r', xls2tstamp(39604.62164)); ? outputs ... Thu, 05 Jun 2008 15:55:09 +0100 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert excel time to date time
Hi, I've been trying to convert this excel date to the date time format, but only managed to get it up to the seconds; The following code; # $data=39604.62164; date(Y-m-d,mktime(0,0,0,1,$data-1,1900)); # will give this output 2008-06-05 changing it to date(H-i-s,mktime(0,0,0,1,$data-1,1900)); will only give 00-00-00 The output I'm looking for is like this one; 2008-06-05 14:55:09 Any idea? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert excel time to date time
On Sat, 2010-07-17 at 19:47 +0800, Mohd Shakir bin Zakaria wrote: Hi, I've been trying to convert this excel date to the date time format, but only managed to get it up to the seconds; The following code; # $data=39604.62164; date(Y-m-d,mktime(0,0,0,1,$data-1,1900)); # will give this output 2008-06-05 changing it to date(H-i-s,mktime(0,0,0,1,$data-1,1900)); will only give 00-00-00 The output I'm looking for is like this one; 2008-06-05 14:55:09 Any idea? Of course it will, because you're only passing 0 values for the hours, minutes and seconds. I'm not quite sure what the number 39604.62164 represents, or why it is coming up with a value like that when you're passing the number in as the day argument to the date() call, but I assume it allows for a fallover of the date value. Look at the mktime() function on the man page and you'll see the correct usage of it. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] convert files utf8
On 3 June 2010 22:35, Tanel Tammik keevit...@gmail.com wrote: Hi, does anyone know how to convert all files in a directory and in it's subdirectories into utf8 encoding? i am using komodo edit as text-editor. may it has a feature which i cannot find... Br Tanel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What encoding are they currently set to? iconv() [1] and mb_convert_encoding() [2] may both be up to the job. ?php // UNTESTED $FilesLocation = 'C:/Work'; $FromEncoding = 'ISO-8859-1'; $ToEncoding = 'UTF-8'; foreach(new DirectoryIterator($FilesLocation) as $File) { file_put_contents($File-getPathname(), iconv($FromEncoding, $ToEncoding, file_get_contents($File-getPathname(; // file_put_contents($File-getPathname(), mb_convert_encoding(file_get_contents($File-getPathname()), $ToEncoding, $FromEncoding)); } ? If the files are XML with a xml tag like ... ?xml version=1.0 encoding=iso-8859-1 ? then you would have to add additional code to edit that line also. Richard. [1] http://docs.php.net/manual/en/function.iconv.php [2]http://docs.php.net/manual/en/function.mb-convert-encoding.php -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert files utf8
I bank on Notepad++ (open source editor) to do such a thing. It can convert an ASCI file to UTF -8. Give it a shot. On Fri, Jun 4, 2010 at 2:02 PM, Richard Quadling rquadl...@gmail.comwrote: On 3 June 2010 22:35, Tanel Tammik keevit...@gmail.com wrote: Hi, does anyone know how to convert all files in a directory and in it's subdirectories into utf8 encoding? i am using komodo edit as text-editor. may it has a feature which i cannot find... Br Tanel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What encoding are they currently set to? iconv() [1] and mb_convert_encoding() [2] may both be up to the job. ?php // UNTESTED $FilesLocation = 'C:/Work'; $FromEncoding = 'ISO-8859-1'; $ToEncoding = 'UTF-8'; foreach(new DirectoryIterator($FilesLocation) as $File) { file_put_contents($File-getPathname(), iconv($FromEncoding, $ToEncoding, file_get_contents($File-getPathname(; // file_put_contents($File-getPathname(), mb_convert_encoding(file_get_contents($File-getPathname()), $ToEncoding, $FromEncoding)); } ? If the files are XML with a xml tag like ... ?xml version=1.0 encoding=iso-8859-1 ? then you would have to add additional code to edit that line also. Richard. [1] http://docs.php.net/manual/en/function.iconv.php [2]http://docs.php.net/manual/en/function.mb-convert-encoding.php -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Shreyas
Re: [PHP] convert files utf8
At 12:35 AM +0300 6/4/10, Tanel Tammik wrote: Hi, does anyone know how to convert all files in a directory and in it's subdirectories into utf8 encoding? i am using komodo edit as text-editor. may it has a feature which i cannot find... Br Tanel Hi Tanel: Check out: http://www.w3.org/International/questions/qa-htaccess-charset That should cover all directories and files. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert files utf8
Hi, does anyone know how to convert all files in a directory and in it's subdirectories into utf8 encoding? i am using komodo edit as text-editor. may it has a feature which i cannot find... Br Tanel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
Dear Sir/Madam Please unsubscribe Angus Mann angusm...@pobox.com from your database. My husband passed away 6 May 2010. Thank you Sonya Mann - Original Message - From: tedd tedd.sperl...@gmail.com To: php-general@lists.php.net Sent: Monday, May 31, 2010 12:20 AM Subject: Re: [PHP] Convert UTF-8 to PHP defines At 10:20 PM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: On Sat, 29 May 2010 10:16:39 -0400, tedd wrote: At 7:15 AM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: No. There are no glyphs in Unicode. This is spelled out for you in chapter 2, figure 2-2. Characters versus Glyphs. Code points are simply unique numbers assigned to specific characters in an approved char set. To better understand which character is represented a representative Glyph is used -- what else would we use, Right. I should have phrased that differently. a chicken? U+9e21 ? U+540D ? LOL I forgot that the word chicken appears in several other languages as a single character. Interesting to note that in the Chinese Dictionary, the character U+9e21 Chicken (ji) is interchangeable with prostitution. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
At 10:20 PM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: On Sat, 29 May 2010 10:16:39 -0400, tedd wrote: At 7:15 AM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: No. There are no glyphs in Unicode. This is spelled out for you in chapter 2, figure 2-2. Characters versus Glyphs. Code points are simply unique numbers assigned to specific characters in an approved char set. To better understand which character is represented a representative Glyph is used -- what else would we use, Right. I should have phrased that differently. a chicken? U+9e21 ? U+540D ? LOL I forgot that the word chicken appears in several other languages as a single character. Interesting to note that in the Chinese Dictionary, the character U+9e21 Chicken (ji) is interchangeable with prostitution. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
At 7:15 AM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: No. There are no glyphs in Unicode. This is spelled out for you in chapter 2, figure 2-2. Characters versus Glyphs. *blink* *blink* *blink* I read it, but that's not addressing the issue here -- that's something different. You are not understanding the difference between characters, fonts, glyphs, and code points. Here are some definitions taken directly from a Unicode Standard that might help: -- quote Character. The smallest component of written language that has semantic-value; refers to the abstract meaning and/or shape, rather than a specific shape (see also glyph), though in code tables some form of visual representation is essential for members understanding. Font. A collection of glyphs used for the visual depiction of character data. A font is often associated with a set of parameters (for example, size posture, weight, and serifness), which, when set to particular values, generates a collection of imaginable glyphs. Glyph. (1) An abstract for that represents one or more glyph images. (2) A synonym for glyph image. In displaying Unicode character data, one or more glyphs may be selected to depict a particular character. These glyphs are selected by a rendering engine during composition and layout processing. -- unquote As such, you cannot claim There are no glyphs in Unicode for that is silly. Code points are simply unique numbers assigned to specific characters in an approved char set. To better understand which character is represented a representative Glyph is used -- what else would we use, a chicken? I may have been liberal in my use of the term Glyph in previous brief email, but Glyph in Unicode has a special meaning. The Glyph 'A' is 'A' regardless of if it is Helvetical or Times, bold or italic, 12pt or 24pt glyph. Likewise the Yin-Yang symbol is a Glyph that has a single code point regardless of if it is red and black or green and blue glyph. But the point is -- there is a unique code point (041 HEX) for the Latin 'A' Glyph and one unique code point (262F HEX) for the Miscellaneous Symbols Yin-Yang Glyph -- WITH -- a representative Glyph in the Unicode table defining each code point! So, when I say that just about every Glyph in the world has been provided a code point I am basically and technically correct -- excepting of course those glyphs that are not considered appropriate for inclusion or are variation glyphs of the representative Glyph that is already included -- understand? After all is said and done, what is Unicode all about? It is assigning a universal and unique code point system to Glyphs that are considered to be appropriate representative members of abstract written forms of communication. But of course those are Glyphs for what else could they be? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Sat, 29 May 2010 10:16:39 -0400, tedd wrote: At 7:15 AM +0200 5/29/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: No. There are no glyphs in Unicode. This is spelled out for you in chapter 2, figure 2-2. Characters versus Glyphs. Code points are simply unique numbers assigned to specific characters in an approved char set. To better understand which character is represented a representative Glyph is used -- what else would we use, Right. I should have phrased that differently. a chicken? U+9e21 ? U+540D ? /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Fri, 2010-05-28 at 11:51 +0800, Guus Ellenkamp wrote: I would like if you stick to the original issue: can a PHP source file be in utf-8. It's not about the output, that is properly supported. Think it would be a good idea anyhow that PHP would support utf-8 source files as it seems utf-8 is going to be the de-facto standard for text files anyhow. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274988834.2202.285.ca...@localhost... On Thu, 2010-05-27 at 15:28 -0400, Bob McConnell wrote: From: tedd The Unicode database uses the same lower character values (i.e., code points) as does ASCII, namely 0-127, and thus UFT-8 (8-bit variable width encoding) is really a super-set which includes the sub-set of ASCII. The Wingdings font that Ash refers to is the really the Dingbat char set in Unicode, as shown here: The use of UFT-8 encoding in everything (web and php) should present much less problems globally than it is trying to fight it. Thanks tedd, The real question is whether unicode is even relevant now that the UTF series is available. I see no reason to have to deal with two competing specifications, when one of them is more than adequate for the job and the other is not even finished yet. That's like the old days when a few users demanded we support both ASCII and EBCDIC. That didn't get very far either. Bob McConnell Bob, UTF is unicode (Unicode Transformation Format) Interesting enough to note, and not sure if Tedd knows this or not (he probably does!) but Chrome has a nice feature for those punycode URLs; it suggests the actual real URL instead once you type the domain in. Not sure about Safari right now, couldn't be bothered to fire up a VM just to check. I would assume Firefox handles these URLs well enough too. Tedd, does that URL actually go anywhere, as I got nothing when I tried visiting it, both the actual URL and the punycode version. Thanks, Ash http://www.ashleysheridan.co.uk Yes is the quick answer. There's no better way than to try it yourself. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert UTF-8 to PHP defines
On 28 May 2010 04:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: And I need(ed) this stuff especially for non-ASCII characters like Chinese, Arabic and stuff :) Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274976794.2202.274.ca...@localhost... On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote: On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. Adam I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (½??, etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Do you mean ... ?php echo '早晨好'; ? If you cut and paste that into your editor, make sure that the font you are using is a UTF-8 font. Otherwise you will see the font's unknown symbol glyph rather than the correct ones. If your font doesn't have the symbols, it doesn't affect the code. The editor is only displaying the code. It doesn't alter the code. Richard. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert UTF-8 to PHP defines
Bob wrtote: The real question is whether unicode is even relevant now that the UTF series is available. Ashley answered: Bob, UTF is unicode (Unicode Transformation Format) Yes, Ashley is correct. UTF-8 is Unicode, as is UTF-16 and UTF-32, which all use different a number of bytes for each code point. Both UTF-8 and UTF-16 are variable length whereas UTF-32 is a fixed length of four bytes per code point. As is my understanding, UTF-8 will accommodate all the languages (glyphs) of the world and then some. It will be a while before we need UTF-16 or UTF-32 but those are just a larger super-sets. In any event, I always use UTF-8 in all my encoding. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert UTF-8 to PHP defines
At 8:33 PM +0100 5/27/10, Ashley Sheridan wrote: Tedd, does that URL actually go anywhere, as I got nothing when I tried visiting it, both the actual URL and the punycode version. Ash: Try it again (it worked for me). In any event, the link was supposed to be redirected to this site: http://xn--fci.com If you run Safari, then the url will be shown as a check-mark. My most popular IDNS site is square-root dot com (option v): http://xn--19g.com The story about that site is on the web page -- you may read if interested. The site receives over 150 unique Mac visitors per day and that number keeps climbing -- I don't know why. For example, one day I had over 800 visitors from Spain -- why??? Obviously, I'm trying to sell the domain (for 6 figures), but have had no takers. I can always get back into Macintosh software development and use the site to sell my own apps -- that's an option I ponder whenever my clients don't call me for a week. Who knows what may happen. Cheers, tedd PS: I have over a dozen IDNS domains including the Pharmaceutical Icon, Yin-Yang Symbol, Sigma, Delta, and DOT dot com (option 8). -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Fri, 28 May 2010 11:13:35 -0400, tedd wrote: Bob wrtote: The real question is whether unicode is even relevant now that the UTF series is available. Ashley answered: Bob, UTF is unicode (Unicode Transformation Format) Or more precisely, UTF-{8,16,32} are different ways to serialize Unicode code points into sequences of octets that makes it possible to store and transmit Unicode data. Yes, Ashley is correct. UTF-8 is Unicode, as is UTF-16 and UTF-32, which all use different a number of bytes for each code point. Both UTF-8 and UTF-16 are variable length whereas UTF-32 is a fixed length of four bytes per code point. As is my understanding, UTF-8 will accommodate all the languages (glyphs) of the world and then some. It will be a while before we need UTF-16 or UTF-32 but those are just a larger super-sets. *blink* They are all capable of representing the full Unicode range, which is restricted to U+ - U+10. The theoretical limits are: UTF-8 [0 - 7fff] UTF-16 [0 - 10] UTF-32 [0 - ] Also, there are many, many, *many* more glyphs than characters (code point) in the world. As an example, www.fonts.com lists 165,125 fonts. Every one has a *different* glyph for the characer A... /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
At 8:52 PM +0200 5/28/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: On Fri, 28 May 2010 11:13:35 -0400, tedd wrote: As is my understanding, UTF-8 will accommodate all the languages (glyphs) of the world and then some. It will be a while before we need UTF-16 or UTF-32 but those are just a larger super-sets. *blink* They are all capable of representing the full Unicode range, which is restricted to U+ - U+10. The theoretical limits are: UTF-8 [0 - 7fff] UTF-16 [0 - 10] UTF-32 [0 - ] Also, there are many, many, *many* more glyphs than characters (code point) in the world. As an example, www.fonts.com lists 165,125 fonts. Every one has a *different* glyph for the characer A... /Nisse *blink* *blink* As you say, UTF-8 has a range of 0 to 7FFF Forgive me, but isn't that 2,147,483,647 (DEC) code points? Please note that 165,125 * 48 (upper/lower case) is only 7,925,952 code points -- IF -- each letter of each font was to have it's own code point, which is not the case for Unicode. Code points are assigned to specific char sets that belong to specific language sets, such as English being assigned to the code point range that is common with ASCII. From that, we can have as many fonts as your software can handle. However, ASCII 65 DEC (41 HEX) or code point 65 (41 HEX) is still tied to the letter A regardless of if it is Helvetical or Times. So, don't confuse code points with fonts. If you spend some time looking at the numerous char sets that Unicode offers you will see that just about every symbol known to man has been cataloged -- even Klingon was considered. From Dingbats to Architectural symbols, from simplified Chinese to traditional Chinese, from Greek to Cherokee, from skull/cross-bones to yin/yang symbol, every language in the world and glyph known to man has been included -- a truly massive project. IMO, it will be a while before we use up all the range Unicode code points provides. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Fri, 28 May 2010 16:52:09 -0400, tedd wrote: At 8:52 PM +0200 5/28/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: On Fri, 28 May 2010 11:13:35 -0400, tedd wrote: As is my understanding, UTF-8 will accommodate all the languages (glyphs) of the world and then some. It will be a while before we need UTF-16 or UTF-32 but those are just a larger super-sets. Again: The theoretical limits are: UTF-8 [0 - 7fff] UTF-16 [0 - 10] UTF-32 [0 - ] In what way are UTF-16 and -32 super-sets of UTF-8? Also, there are many, many, *many* more glyphs than characters (code point) in the world. As an example, www.fonts.com lists 165,125 fonts. Every one has a *different* glyph for the characer A... As you say, UTF-8 has a range of 0 to 7FFF No, I said that's the theoretical range. It is restricted to [0-10] according to current specifications. If you spend some time looking at the numerous char sets that Unicode offers you will see that just about every symbol known to man has been cataloged Yes. (Except those that are missing). every language in the world and glyph known to man has been included -- a truly massive project. No. There are no glyphs in Unicode. This is spelled out for you in chapter 2, figure 2-2. Characters versus Glyphs. /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
Hello Guus, Actually, we are using the same method here on http://oire.org/. We have all of the language files in UTF8 format and everything seems to be OK. Yes, unicode support in PHp laisse à désirer, like the French say, but it does support UTF8 files. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Guus Ellenkamp ellenkamp_g...@hotmail.com To: php-general@lists.php.net php-general@lists.php.net Date: Wednesday, May 26, 2010, 5:20:59 PM Subject: [PHP] Convert UTF-8 to PHP defines We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Thu, 2010-05-27 at 21:45 +0800, Guus Ellenkamp wrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk Very sure, ever PHP file I ever make is always in utf8. The only problem you might encounter is when outputting HTML, you should make sure that you output the right text encoding headers, as some browsers won't correctly detect it and can tend to output utf-8 characters as random blocks and other characters. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert UTF-8 to PHP defines
On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
Re: [PHP] Convert UTF-8 to PHP defines
On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote: On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. Adam I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (½✉✆, etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert UTF-8 to PHP defines
At 5:13 PM +0100 5/27/10, Ashley Sheridan wrote: I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (12), etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. Thanks, Ash Ash: I read briefly on the css discuss list there is a movement to force download of fonts (i.e., char sets) to make layouts work. Apparently some browsers allow for that but I have not read up on it and I may have the wrong impression, but that was my take. For the exception of evil fonts, it seemed like a good idea. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert UTF-8 to PHP defines
From: Ashley Sheridan On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote: On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)... chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)... chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (½✉✆, etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. What higher range? ASCII only defined 128 values, the bottom 32 being control characters that don't print. Anything outside of that is not ASCII, but a proprietary extension. In particular, the glyphs usually associated with 0-32 and 128-255 are IBM specific and not guaranteed to be present outside of their original video ROM. So only the first 128 characters map directly into UTF-8. Bob McConnell Ref: pp 25-29 The Programmer's PC Sourcebook, 1988, Thom Hogan, Microsoft Press
RE: [PHP] Convert UTF-8 to PHP defines
On Thu, 2010-05-27 at 14:06 -0400, Bob McConnell wrote: From: Ashley Sheridan On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote: On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)... chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)... chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (½✉✆, etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. What higher range? ASCII only defined 128 values, the bottom 32 being control characters that don't print. Anything outside of that is not ASCII, but a proprietary extension. In particular, the glyphs usually associated with 0-32 and 128-255 are IBM specific and not guaranteed to be present outside of their original video ROM. So only the first 128 characters map directly into UTF-8. Bob McConnell Ref: pp 25-29 The Programmer's PC Sourcebook, 1988, Thom Hogan, Microsoft Press The higher range of utf8 characters that don't map to ascii values. Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Convert UTF-8 to PHP defines
At 7:11 PM +0100 5/27/10, Ashley Sheridan wrote: On Thu, 2010-05-27 at 14:06 -0400, Bob McConnell wrote: From: Ashley Sheridan I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (12), etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. What higher range? ASCII only defined 128 values, the bottom 32 being control characters that don't print. Anything outside of that is not ASCII, but a proprietary extension. In particular, the glyphs usually associated with 0-32 and 128-255 are IBM specific and not guaranteed to be present outside of their original video ROM. So only the first 128 characters map directly into UTF-8. Bob McConnell Ref: pp 25-29 The Programmer's PC Sourcebook, 1988, Thom Hogan, Microsoft Press The higher range of utf8 characters that don't map to ascii values. Thanks, Ash Bob: I understood what Ash was referring re his higher range statement, but his second statement was somewhat confusing. ASCII is defined as characters having a value of 0-127 DEC (00-7F HEX). The higher range of 128-255 DEC (80-FF HEX) have been loosely characterized as extended ASCII but have not been officially declared such. Both M$ and Apple have their own characters appearing the range and have used different character for different things -- thus problems arose is using either. I do not know if the problem was ever resolved. It's probably best to never use such characters. The Unicode database uses the same lower character values (i.e., code points) as does ASCII, namely 0-127, and thus UFT-8 (8-bit variable width encoding) is really a super-set which includes the sub-set of ASCII. The Wingdings font that Ash refers to is the really the Dingbat char set in Unicode, as shown here: http://www.unicode.org/charts/PDF/U2700.pdf These are real characters that can be used for all sorts of things including url's, for example: http://xn--gci.com Please forgive the PUNYCODE url, but IE does not recognize other than ASCII characters in url's, whereas Safari will show the url correctly. Clearly, Safari has the upper hand in resolving other than English issues -- perhaps that's why their overseas profits last year exceeded their domestic -- but I digress. The use of UFT-8 encoding in everything (web and php) should present much less problems globally than it is trying to fight it. Here's some references that may help: [1] http://webstandardsgroup.org/ [2] http://www.w3.org/People/Ishida/ [3] http://www.w3.org/International [4] http://shiflett.org/archive/177 [5] http://en.wikipedia.org/wiki/Universal_character_set [6] http://www.unicode.org/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert UTF-8 to PHP defines
From: tedd The Unicode database uses the same lower character values (i.e., code points) as does ASCII, namely 0-127, and thus UFT-8 (8-bit variable width encoding) is really a super-set which includes the sub-set of ASCII. The Wingdings font that Ash refers to is the really the Dingbat char set in Unicode, as shown here: The use of UFT-8 encoding in everything (web and php) should present much less problems globally than it is trying to fight it. Thanks tedd, The real question is whether unicode is even relevant now that the UTF series is available. I see no reason to have to deal with two competing specifications, when one of them is more than adequate for the job and the other is not even finished yet. That's like the old days when a few users demanded we support both ASCII and EBCDIC. That didn't get very far either. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert UTF-8 to PHP defines
On Thu, 2010-05-27 at 15:28 -0400, Bob McConnell wrote: From: tedd The Unicode database uses the same lower character values (i.e., code points) as does ASCII, namely 0-127, and thus UFT-8 (8-bit variable width encoding) is really a super-set which includes the sub-set of ASCII. The Wingdings font that Ash refers to is the really the Dingbat char set in Unicode, as shown here: The use of UFT-8 encoding in everything (web and php) should present much less problems globally than it is trying to fight it. Thanks tedd, The real question is whether unicode is even relevant now that the UTF series is available. I see no reason to have to deal with two competing specifications, when one of them is more than adequate for the job and the other is not even finished yet. That's like the old days when a few users demanded we support both ASCII and EBCDIC. That didn't get very far either. Bob McConnell Bob, UTF is unicode (Unicode Transformation Format) Interesting enough to note, and not sure if Tedd knows this or not (he probably does!) but Chrome has a nice feature for those punycode URLs; it suggests the actual real URL instead once you type the domain in. Not sure about Safari right now, couldn't be bothered to fire up a VM just to check. I would assume Firefox handles these URLs well enough too. Tedd, does that URL actually go anywhere, as I got nothing when I tried visiting it, both the actual URL and the punycode version. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert UTF-8 to PHP defines
And I need(ed) this stuff especially for non-ASCII characters like Chinese, Arabic and stuff :) Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274976794.2202.274.ca...@localhost... On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote: On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp ellenkamp_g...@hotmail.comwrote: Thanks, but are you sure of that? I did some research a while ago and found that officially PHP files should be ascii and not have any specific character encoding. I believe it will work anyhow (did not try this one), but would like to stick with the standards. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274883714.2202.228.ca...@localhost... On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Because the lower range of UTF-8 matches the ascii character set (intentionally by design), you'll be able to use UTF-8 for PHP files without problem (i.e., ascii 7-bit chars have same encoding in UTF-8.) http://www.cl.cam.ac.uk/~mgk25/unicode.html However, if you were to use any of the multibyte characters of UTF-8 in a PHP file, you could run in to some trouble. I use UTF-8 for most of my PHP files, but I've been sticking to the ASCII subset exclusively. Adam I don't use the higher range of characters often, but I do sometimes use them for things like the graphical glyphs (½??, etc) I know I could do those with regular text and the Wingdings font, but that's not available on every computer, and breaks the semantic meaning behind the glyphs. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
I would like if you stick to the original issue: can a PHP source file be in utf-8. It's not about the output, that is properly supported. Think it would be a good idea anyhow that PHP would support utf-8 source files as it seems utf-8 is going to be the de-facto standard for text files anyhow. Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1274988834.2202.285.ca...@localhost... On Thu, 2010-05-27 at 15:28 -0400, Bob McConnell wrote: From: tedd The Unicode database uses the same lower character values (i.e., code points) as does ASCII, namely 0-127, and thus UFT-8 (8-bit variable width encoding) is really a super-set which includes the sub-set of ASCII. The Wingdings font that Ash refers to is the really the Dingbat char set in Unicode, as shown here: The use of UFT-8 encoding in everything (web and php) should present much less problems globally than it is trying to fight it. Thanks tedd, The real question is whether unicode is even relevant now that the UTF series is available. I see no reason to have to deal with two competing specifications, when one of them is more than adequate for the job and the other is not even finished yet. That's like the old days when a few users demanded we support both ASCII and EBCDIC. That didn't get very far either. Bob McConnell Bob, UTF is unicode (Unicode Transformation Format) Interesting enough to note, and not sure if Tedd knows this or not (he probably does!) but Chrome has a nice feature for those punycode URLs; it suggests the actual real URL instead once you type the domain in. Not sure about Safari right now, couldn't be bothered to fire up a VM just to check. I would assume Firefox handles these URLs well enough too. Tedd, does that URL actually go anywhere, as I got nothing when I tried visiting it, both the actual URL and the punycode version. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert UTF-8 to PHP defines
We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert UTF-8 to PHP defines
On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote: We use PHP defines for defining text in different languages. As far as I know PHP files are supposed to be ASCII, not UTF-8 or something like that. What I want to make is a conversion program that would convert a given UTF-8 file with the format definetext1=this is a text in random UTF-8, probably arabic or similar text definetext2=this is another text in random UTF-8, probably arabic or similar text into a file with the following defines define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value)); Not sure if I'm using the correct chr/ord function, but I hope the above is clear enough to make clear what I'm looking for. Basically the output file should be ascii and not contain any utf-8. Any advise? The html_special_chars did not seem to work for Vietnamese text I tried to convert, so something seems to get wrong with just reading an array of strings and converting the strings and putting them in defines. PHP files can contain utf-8, and in-fact is the preference of most developers I know of. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] convert a string into an array
it's about telepathy. mass-telepathy ;) telepathic pressure. death threats through telepathy, of which i've had quite a few in past weeks.. fear begets fear begets disease... but thanks for the compliment ;) On Mon, Apr 5, 2010 at 6:53 AM, Nathan Rixham nrix...@gmail.com wrote: you sure you're only smoking cigarettes? has to be one of the most random replies to any php thread I've ever seen - awesome! regards Rene Veerman wrote: yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Greetings from Rene7705, I have made some free open source webcomponents designed and written by me available through: http://code.google.com/u/rene7705/ , or http://mediabeez.ws (latest dev versions, currently offline) - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert a string into an array
On Mon, Apr 5, 2010 at 4:09 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Mon, 2010-04-05 at 05:53 +0100, Nathan Rixham wrote: you sure you're only smoking cigarettes? has to be one of the most random replies to any php thread I've ever seen - awesome! regards Rene Veerman wrote: yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Virus maybe? Thanks, Ash http://www.ashleysheridan.co.uk yup, i'm on the global anti-t-viral team. and as such more often a target of deaththreats through telepathy than most other humans in my (economic) position. however, if you dont believe in telepathy; KEEP IT THAT WAY :))) hearing voices is only the snow on the tip of the iceberg when it comes to telepathy (between (living) humans and non-human intelligences.. and i'll really try to make this my last telepathy-related post to this list, this year at least... -- - Greetings from Rene7705, I have made some free open source webcomponents designed and written by me available through: http://code.google.com/u/rene7705/ , or http://mediabeez.ws (latest dev versions, currently offline) -
Re: [PHP] convert a string into an array
On Mon, 2010-04-05 at 05:53 +0100, Nathan Rixham wrote: you sure you're only smoking cigarettes? has to be one of the most random replies to any php thread I've ever seen - awesome! regards Rene Veerman wrote: yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Virus maybe? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] convert a string into an array
yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert a string into an array
you sure you're only smoking cigarettes? has to be one of the most random replies to any php thread I've ever seen - awesome! regards Rene Veerman wrote: yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert a string into an array
Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert a string into an array
Andre Polykanine wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! Do something like this: $tonames = (is_array($tonames) ? $tonames : array($tonames) ); $toemails = (is_array($toemails) ? $toemails : array($toemails)); -- Jim Lucas NOC Manager 541-323-9113 BendTel, Inc. http://www.bendtel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers forequivalent PCRE functions
Paul M Foster pa...@quillandmouse.com wrote in message news:20091109030235.gh3...@quillandmouse.com... On Sun, Nov 08, 2009 at 06:30:37PM -0500, Robert Cummings wrote: Also, why support two libraries for which one is obviously inferior in speed and functionality? Because Tony's Radicore framework has a bunch of ereg* calls in it. ;-} Just like a lot of other people's work. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Robert Cummings rob...@interjinn.com wrote in message news:4af76e1f.2050...@interjinn.com... Tony Marston wrote: Robert Cummings rob...@interjinn.com wrote in message Then you've got several options: 1) Don't upgrade PHP. Not an acceptable option. 2) Pick a different hosting provider. Not an acceptable optional. 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. I think you're missing the point of a full version increase. This is not a minor or micro version change... script breakage is *expected*. But breakage should be kept to an absolute minimum, and developer laziness or incompetence is not an acceptable excuse. Not quite true... major version moves are an opportunity to make a break for freedom. All there needs to be is an upgrade path... and that is clearly in play right now with the warning indicating that POSIX regex functions are being deprecated. But a lot of people won't see those warnings until they run 5.3.0 for the first time. It is common practice, at least in all the other languages that I have used, that is something is going to be removed that it is marked as deprecated at the start of the previous release, not at the end. So marking the POIX functions as deprecated should have happened in 5.0, not 5.3. You don't think PHP should support legacy cruft in the core forever do you? Widely use regex functions are not legacy cruft. Besides, who decides what is cruft and should be removed from the language? They most certainly are cruft. That is just your opinion. Other people think that PHP should be rewritten so that it appears more like their favourite language. Among the suggestions I have seen are: - make all variables statically typed instead of dynamically typed. - remove all procedural functions and make the language pure OO. Who decides if they are right? .. hence the reason they are being removed. The people who decide what is, and is not, cruft are the very same people who are writing the code. If you are not happy with this then there's the age old saying in open source... put up or shut up. I can't because I don't program in C. So I shall do the nextbest thing - complain at every opporunity. If unicode support is slopped onto the current POSIX regex functions won't that then make them non-POSIX? Food for thought. Also, why support two libraries for which one is obviously inferior in speed and functionality? That is why I suggested that instead of dropping the POSIX functions entirely and seriously annoying lots of users, that they should simply be rewritten as wrappers for the PCRE functions. In that way all the calls to ereg_* would still work, but all they would do is immediately call the relevant preg_* function. The small amount of effort that tghis would take would kill two birds with one stone: (1) There would be only one regex engine to support, which would be PCRE. (2) Lots of developers would be spared the hassle of modifying their code as all the calls to POSIX functions would still work as expected because the language would redirect to the PCRE function automatically. This would probably be worse than removing the POSIX functions. POSIX and PCRE I daresay are not completely compatible. probably and daresay mean that you are just guessing. According to some people who know what they are talking about there is a one-for-one comparison between each POSIX and each PCRE function. At least when you remove the POSIX functions then the problem space is well defined. And lots of sers will be pissed off because they won'tbe able to upgrade to PHP 6 without major programmer intervention. Suddenly having POSIX regex functions that are really wrappers around PCRE functions may introduce subtle differences in output for the same horde of users but without the same explicability. may introduce? There you go, guessng again. Can you point out *any* POSIX function that cannot be converted into PCRE? I am not suggesting that the POSIX functions be rewritten to deal with unicode as that would require a huge amount of effort, but by redirecting al POSIX calls to the equivalent PCRE function would have the same effect for far less effort. The choice is simple - either a small amount of effort from a small number of developers, or a large amount of effort from a large number of seriously pissed-off users. Do the maths. It's not rocket science. This isn't a mathematical problem. It's a question of correctness. Lot's of PHP users, myself included, do not think that it is correct to remove widely used functionality just beause the developers are too lazy to do a proper job. I wasn't happy to hear POSIX regex functions were going either, but when I heard the reasoning I did the best thing I could... I fixed my code to prepare for the inevitable. So you had to fix what wasn't broken just to circumvent a stupid decision by the PHP
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On Mon, 2009-11-09 at 00:23 +, Tony Marston wrote: developer laziness or incompetence is not an acceptable excuse. Exactly, so fix your scripts! I do wonder though, what hosting company you use that would just upgrade to PHP6 without warning on you and 'break' your scripts, yet at the same time would not allow you to install what you call an 'amateur fudge'. I can't think of any hosting company that would care so little about their customers. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1257764339.1076.56.ca...@localhost... On Mon, 2009-11-09 at 00:23 +, Tony Marston wrote: developer laziness or incompetence is not an acceptable excuse. Exactly, so fix your scripts! But my scripts aren't broken! It's PHP 6 that is broken. I do wonder though, what hosting company you use that would just upgrade to PHP6 without warning on you and 'break' your scripts, How many hosting companies write to all their account holders to ask permission before upgrading PHP, not just from 4 to 5, but all the releases in between? Very few of them, if any, in my experience. yet at the same time would not allow you to install what you call an 'amateur fudge'. I can't think of any hosting company that would care so little about their customers. Some hosting companies won't allow you to use htaccess files, refuse to install any optional extension, let alone one from the PECL or PEAR repositories. Some of them won't give you more than one MySQL database. Different companies provide different levels of service. The only thing that the DO have in common is that they charge you for it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
2009/11/9 Tony Marston t...@marston-home.demon.co.uk: So you wouldn't trust the PHP developers to write simple code which takes each POSIX function and redirects it to a PCRE function? I have more faith in their ability than I do yours. If it's as simple as you claim, why don't you mock-up your solution in PHP, rather than C? You'll get taken more seriously if you have working code that someone can write unit tests against. If your solution doesn't get any traction with the core team, you'll still be able to offer it to the community as a simple download, just include this at the top of your script to fix ereg*() not found problems. That would be really useful to all those people whose cause you are championing. (BTW, the reference implementation for PHP is... PHP. There isn't an ISO standard or anything here. How PHP6 behaves is correct, because it's PHP6). (BTW^2 - you're on the wrong list for this. If you want to influence the guys who make the decisions you need to take this to php-internals, where the heavyweights hang out). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Tony Marston wrote: How many hosting companies write to all their account holders to ask permission before upgrading PHP, not just from 4 to 5, but all the releases in between? Very few of them, if any, in my experience. I've no idea what horrible hosting companies you've had experiences with, however all of the companies I've used in the last few years have had an option to move back and forth between PHP4 and PHP5 in the event that certain scrips/frameworks/apps/whatever required one version over the other. What makes you think these companies won't do the same thing when they finally decide to add PHP6 to their servers? I doubt very many reputable hosting companies would simply upgrade to the latest flavor of PHP/Apache/MySQL/anything simply because it was released this morning without doing ample internal testing; if you or your clients are using one that does this - I'd advise you look elsewhere. Whenever PHP6 reaches a stable release build, it will still be quite some time before its offered as an option to any mainstream shared hosting service - this should leave you ample time to adapt to incoming changes. Failing that, you always have the option of purchasing your own server or VPS from any number of hosts to configure as you see fit. Or you can explain your moral outrage to potential clients detailing your refusal to work because you disagree with a proposed change that won't see the light of day for years to come; your call. Incessant whining under the guise of expressing your own opinion isn't going to make everything better. Sorry.
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
David Otton phpm...@jawbone.freeserve.co.uk wrote in message news:193d27170911090331k7ecbe69cl1dd30651273e7...@mail.gmail.com... 2009/11/9 Tony Marston t...@marston-home.demon.co.uk: So you wouldn't trust the PHP developers to write simple code which takes each POSIX function and redirects it to a PCRE function? I have more faith in their ability than I do yours. If it's as simple as you claim, why don't you mock-up your solution in PHP, rather than C? Because I can't do that until I install PHP 6, but as I never play with beta software waiting for it to go live will be too late. You'll get taken more seriously if you have working code that someone can write unit tests against. If your solution doesn't get any traction with the core team, you'll still be able to offer it to the community as a simple download, just include this at the top of your script to fix ereg*() not found problems. That would be really useful to all those people whose cause you are championing. (BTW, the reference implementation for PHP is... PHP. There isn't an ISO standard or anything here. How PHP6 behaves is correct, because it's PHP6). (BTW^2 - you're on the wrong list for this. If you want to influence the guys who make the decisions you need to take this to php-internals, where the heavyweights hang out). I have tried subscribing to the internals list, but none of my postings ever appears. I've tried looking at the PHP wiki, but I cannot see any method of creating an RFC. I have, however, created a request in php_compat in the PEAR system at http://pear.php.net/bugs/bug.php?id=16769 -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On 11/9/09 8:56 AM, Tony Marston t...@marston-home.demon.co.uk wrote: I have tried subscribing to the internals list, but none of my postings ever appears. That's unfortunate as you missed this thread: http://marc.info/?t=12553625831r=1w=2 Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
2009/11/9 Tony Marston t...@marston-home.demon.co.uk: Because I can't do that until I install PHP 6, but as I never play with beta software waiting for it to go live will be too late. Not sure why not. If it's just the name collision, call them alt_ereg*() until ereg*() goes away. In fact, it's much easier to write unit tests against your new functions if the old functions are still hanging around. I've tried looking at the PHP wiki, but I cannot see any method of creating an RFC. Well, the RFCs are here, but you probably already found them: http://wiki.php.net/rfc (register is in the bottom-right corner). Can't help you with your php-internals problem, I'm afraid. Tried emailing the list manager? I have, however, created a request in php_compat in the PEAR system at http://pear.php.net/bugs/bug.php?id=16769 Fair enough. Good luck. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On Mon, 2009-11-09 at 15:49 +, David Otton wrote: 2009/11/9 Tony Marston t...@marston-home.demon.co.uk: Because I can't do that until I install PHP 6, but as I never play with beta software waiting for it to go live will be too late. Not sure why not. If it's just the name collision, call them alt_ereg*() until ereg*() goes away. In fact, it's much easier to write unit tests against your new functions if the old functions are still hanging around. I've tried looking at the PHP wiki, but I cannot see any method of creating an RFC. Well, the RFCs are here, but you probably already found them: http://wiki.php.net/rfc (register is in the bottom-right corner). Can't help you with your php-internals problem, I'm afraid. Tried emailing the list manager? I have, however, created a request in php_compat in the PEAR system at http://pear.php.net/bugs/bug.php?id=16769 Fair enough. Good luck. And what about something like this as an internal wrapper: if(!function_exists('ereg_*')) { function ereg_*() { } } And you should at least try to test the code you write for your clients on PHP6 if that is where it is going to be hosted before servers are upgraded, even if it's just to find out if it will break and give you time to fix it. Hell, you could probably charge for that if the client absolutely has to be on a PHP6 server, as something like that would fall outside the scope of future maintenance, unless of course you wrote your code in full knowledge of the change that would happen in PHP6. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Tony Marston wrote: Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1257764339.1076.56.ca...@localhost... On Mon, 2009-11-09 at 00:23 +, Tony Marston wrote: developer laziness or incompetence is not an acceptable excuse. Exactly, so fix your scripts! But my scripts aren't broken! It's PHP 6 that is broken. Actually when PHP 6 comes out... it will be your scripts that are broken. The language doesn't adapt to you for every version change. YOU adapt to the language, otherwise YOUR scripts ARE broken. Some hosting companies won't allow you to use htaccess files, refuse to install any optional extension, let alone one from the PECL or PEAR repositories. Some of them won't give you more than one MySQL database. Different companies provide different levels of service. The only thing that the DO have in common is that they charge you for it. Then switch hosting company. Or pony up the extra $5 or $10 per month or so for a VPS that gives you root access and all the configurability you could want. Lack of choice is NOT the fault of PHP. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
The POSIX regex functions are currently marked as DEPRECATED in 5.3.0 and are due to be removed completely in PHP 6. I propose that instead of being dropped they be converted into wrappers for the equivalent PCRE functions. It does not matter how long various people have been preaching in various unofficial channels that users should switch to using the PCRE functions (preg_*) instead of the POSIX ones (ereg_*) as many users simply do not access those channels. The first time that a significant number of users will become aware of this is when they switch to 5.3.0 or later, and they will be very, very upset. Some users do not test their applications against each new PHP version as it comes out, they just use whatever version their hosting company provides them with. It does not matter that the PHP developers cannot find someone to upgrade the POSIX functions, it does not matter that the same functionality can be provided with the PCRE functions, all the users will know is that their scripts, some of which have been running for many years, will suddenly not work and will need serious programming effort before they can run again. You know how long it took for sites to upgrade from PHP 4 to 5 because of the backward compatibility issues, so imagine even more resistance and a slower uptake for PHP 6. The POSIX functions have been a core part of the language since the early days of PHP, so to suddenly dump them for no good reason will alienate and upset a large number of people. When I say no good reason I mean from the user's point of view. The fact that it is taking (has taken?) considerable effort to get the PCRE functions working with Unicode for PHP 6, and no-one is prepared to spend similar effort on the POSIX functions, may make it seem in the users eyes that the PHP developers are either lazy or incompetent. It does not matter that the PHP developers are unpaid volunteers - that is no reason for shoddy workmanship. If they can't do the job properly they shouldn't do it at all. BC breaks, especially on a range of functions which have been a core part of the language for many, many years, do not go down well with the users, and remember that it is the incredibly large number of people who use PHP, not the efforts of the developers, that has made it such a popular language. So annoying large numbers of users will create a PR disaster. If the PCRE functions have been made to work with Unicode, and each of the POSIX functions has a PCRE equivalent, then surely an intelligent move would be to convert all the POSIX functions into simple wrappers for their PCRE equivalents. So instead of spending huge amounts of effort in making the POSIX functions work with Unicode you simply cut out the code behind each POSIX function and replace it to a call to the relevant PCRE function. This should only require a relatively small amount of developer effort which should be balanced against the huge amount that would otherwise be required in userland. If the PHP developers are not prepared to undertake this small amount of effort then they should be prepared for considerable amounts of fallout from lots of unhappy users. I would strongly suggest that a start be made on this as soon as possible so that the changeover to PCRE wrappers can be fully tested and debugged before PHP 6 goes live. This will make the changeover from POSIX to PCRE totally transparent, and will be greatly appreciated in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston t...@marston-home.demon.co.uk wrote: That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Then you've got several options: 1) Don't upgrade PHP. 2) Pick a different hosting provider. 3) Fix your scripts. You talk about a professional fix. The right fix is to remove the depracated elements from your scripts before upgrading PHP, which realistically shouldn't be that big of a deal for the vast majority of expressions. Rather than accept the change and just fix your scripts, you propose a problem that breaks a lot of other things and introduces way more problems than it solves. You're not the first person to post this exact same tantrum on this list and the response has always been: fix your scripts or don't upgrade. Seeing as PHP 6 is a long ways away you've got plenty of time to fix your scripts and it's not like this is being sprung overnight, so do the real professional thing and upgrade your scripts, if you want to upgrade (when 6 is released). Breaking BC happens. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081330v799803f3he6ed60ecc6e67...@mail.gmail.com... On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston t...@marston-home.demon.co.uk wrote: That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Then you've got several options: 1) Don't upgrade PHP. Not an acceptable option. 2) Pick a different hosting provider. Not an acceptable optional. 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. You talk about a professional fix. The right fix is to remove the depracated elements My whole argument is that they shouldn't have been deprecated in the first place. from your scripts before upgrading PHP, which realistically shouldn't be that big of a deal for the vast majority of expressions. It is going to be a VERY big deal for all hose users who suddenly finf that their scripts won't run in PHP 6. Rather than accept the change and just fix your scripts, It's not a change, it's a removal of core functions that have worked flawlessly for years. Both the POSIX and the PCRE functions needed to be updated to work with unicode, but the developers couldn't be bothered to update both. The only reason that the POSIX have been deprecated is because the PHP developers are either too lazy or too incompetent to provide a proper fix. you propose a problem that breaks a lot of other things and introduces way more problems than it solves. You're not the first person to post this exact same tantrum on this l list and the response has always been: fix your scripts The scripts aren't broken, it's PHP 6 that's broken. or don't upgrade. Not an acceptable option. Seeing as PHP 6 is a long ways away you've got plenty of time to fix your scripts Just as the PHP developers have plenty of time to do a proper job. and it's not like this is being sprung overnight, To a lot of peope it will appear to be sprung overnight as the first time they will know that the POSIX functions have been removed is when their scripts don't work. so do the real professional thing The professional thing would be to fix PHP 6 so that is doesn't break existing scripts needlessly. and upgrade your scripts, if you want to upgrade (when 6 is released). Breaking BC happens. There is a difference between breaking BC because of genuinely insurmountable reasons, and breaking it because of pure laziness. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Tony Marston wrote: Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081330v799803f3he6ed60ecc6e67...@mail.gmail.com... On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston t...@marston-home.demon.co.uk wrote: That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Then you've got several options: 1) Don't upgrade PHP. Not an acceptable option. 2) Pick a different hosting provider. Not an acceptable optional. 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. I think you're missing the point of a full version increase. This is not a minor or micro version change... script breakage is *expected*. You don't think PHP should support legacy cruft in the core forever do you? If unicode support is slopped onto the current POSIX regex functions won't that then make them non-POSIX? Food for thought. Also, why support two libraries for which one is obviously inferior in speed and functionality? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Robert Cummings rob...@interjinn.com wrote in message news:4af7549d.1060...@interjinn.com... Tony Marston wrote: Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081330v799803f3he6ed60ecc6e67...@mail.gmail.com... On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston t...@marston-home.demon.co.uk wrote: That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Eddie Drapkin oorza...@gmail.com wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston t...@marston-home.demon.co.uk wrote: It is for the better? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org John Black s...@network-technologies.org wrote in message news:4af70120.1040...@network-technologies.org... The same can be said about the removal of magic_quotes(), it will break A LOT of old scripts. I am in the same boat, I did not keep up to date with the PHP developer plans and just found out about ereg when I installed PHP 5.3. I think it was handled properly by displaying warning messages before actually removing it. It will give people enough time to update their scripts or weed out the old and insecure scripts. Yes, it will create some headache but, AFAIK, it is for the better. -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The plan, as far as I am aware, is to move POSIX regular expressions into PECL as of PHP6. If you can fix your scripts by simply running pecl install ereg what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Then you've got several options: 1) Don't upgrade PHP. Not an acceptable option. 2) Pick a different hosting provider. Not an acceptable optional. 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. I think you're missing the point of a full version increase. This is not a minor or micro version change... script breakage is *expected*. But breakage should be kept to an absolute minimum, and developer laziness or incompetence is not an acceptable excuse. You don't think PHP should support legacy cruft in the core forever do you? Widely use regex functions are not legacy cruft. Besides, who decides what is cruft and should be removed from the language? If unicode support is slopped onto the current POSIX regex functions won't that then make them non-POSIX? Food for thought. Also, why support two libraries for which one is obviously inferior in speed and functionality? That is why I suggested that instead of dropping the POSIX functions entirely and seriously annoying lots of users, that they should simply be rewritten as wrappers for the PCRE functions. In that way all the calls to ereg_* would still work, but all they would do is immediately call the relevant preg_* function. The small amount of effort that tghis would take would kill two birds with one stone: (1) There would be only one regex engine to support, which would be PCRE. (2) Lots of developers would be spared the hassle of modifying their code as all the calls to POSIX functions would still work as expected because the language would redirect to the PCRE function automatically. I am not suggesting that the POSIX functions be rewritten to deal with unicode as that would require a huge amount of effort, but by redirecting al POSIX calls to the equivalent PCRE function would have the same effect for far less effort. The choice is simple - either a small amount of effort from a small number of developers, or a large amount of effort from a large number of seriously pissed-off users. Do the maths. It's not rocket science. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
Tony Marston wrote: Robert Cummings rob...@interjinn.com wrote in message Then you've got several options: 1) Don't upgrade PHP. Not an acceptable option. 2) Pick a different hosting provider. Not an acceptable optional. 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. I think you're missing the point of a full version increase. This is not a minor or micro version change... script breakage is *expected*. But breakage should be kept to an absolute minimum, and developer laziness or incompetence is not an acceptable excuse. Not quite true... major version moves are an opportunity to make a break for freedom. All there needs to be is an upgrade path... and that is clearly in play right now with the warning indicating that POSIX regex functions are being deprecated. You don't think PHP should support legacy cruft in the core forever do you? Widely use regex functions are not legacy cruft. Besides, who decides what is cruft and should be removed from the language? They most certainly are cruft... hence the reason they are being removed. The people who decide what is, and is not, cruft are the very same people who are writing the code. If you are not happy with this then there's the age old saying in open source... put up or shut up. If unicode support is slopped onto the current POSIX regex functions won't that then make them non-POSIX? Food for thought. Also, why support two libraries for which one is obviously inferior in speed and functionality? That is why I suggested that instead of dropping the POSIX functions entirely and seriously annoying lots of users, that they should simply be rewritten as wrappers for the PCRE functions. In that way all the calls to ereg_* would still work, but all they would do is immediately call the relevant preg_* function. The small amount of effort that tghis would take would kill two birds with one stone: (1) There would be only one regex engine to support, which would be PCRE. (2) Lots of developers would be spared the hassle of modifying their code as all the calls to POSIX functions would still work as expected because the language would redirect to the PCRE function automatically. This would probably be worse than removing the POSIX functions. POSIX and PCRE I daresay are not completely compatible. At least when you remove the POSIX functions then the problem space is well defined. Suddenly having POSIX regex functions that are really wrappers around PCRE functions may introduce subtle differences in output for the same horde of users but without the same explicability. I am not suggesting that the POSIX functions be rewritten to deal with unicode as that would require a huge amount of effort, but by redirecting al POSIX calls to the equivalent PCRE function would have the same effect for far less effort. The choice is simple - either a small amount of effort from a small number of developers, or a large amount of effort from a large number of seriously pissed-off users. Do the maths. It's not rocket science. This isn't a mathematical problem. It's a question of correctness. I wasn't happy to hear POSIX regex functions were going either, but when I heard the reasoning I did the best thing I could... I fixed my code to prepare for the inevitable. There's no way I'd trust my code to just work with POSIX functions redirected through PCRE and so I'd still need to do the same legwork. Wrapping the POSIX regex functions around PCRE will lead to more problems than it solves IMHO. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
On Sun, Nov 08, 2009 at 06:30:37PM -0500, Robert Cummings wrote: Also, why support two libraries for which one is obviously inferior in speed and functionality? Because Tony's Radicore framework has a bunch of ereg* calls in it. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert File Sizes (16M = 16777216)
Hello all :) I have a problem, so, Before I'll start building my own function - I was wondering - is there any built-in function to convert 16M to 16777216 (Including all other types of letters)? (16M = 16 * 1024 * 1024) (Its from php.ini configurations) -- Use ROT26 for best security
[PHP] Convert \x3d \x3b \x3c to ASCII
Is there a function which will convert characters like \x3d \x3b \x3c to ASCII. Or is there a full list of conversions, eg \x3c= \x3e=, \x27=' etc. What are these, hex? I tried hexdec() but am not sure that is right. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert \x3d \x3b \x3c to ASCII
ioan...@btinternet.com wrote: Is there a function which will convert characters like \x3d \x3b \x3c to ASCII. Or is there a full list of conversions, eg \x3c=v \x3e=, \x27=' etc. What are these, hex? I tried hexdec() but am not sure that is right. These are hex escaped for a string: ?php echo \x3d \x3b \x3c; ? This will output the actual characters. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Wed, 2009-04-08 at 22:34 -0700, Michael Shadle wrote: On Wed, Apr 8, 2009 at 10:30 PM, Gevorg Harutyunyan gevorg...@gmail.com wrote: Hi, I need to convert video files to FLV using php. The only solution that I found is to use ffmpeg, but because I am using shared hosting I am not allowed to install it on server. Do you know any other ways to convert any video file types to flv using PHP. use ffmpeg. there is an ffmpeg-php extension but it's kinda buggy and i am not sure it supports enough for what you want. but using ffmpeg for it is pretty simple. just system() the calls to it. google for it I know of no way you can do this. Not only would any potential solution be too slow, but it would affect other users of the server, and more than likely result in an email from you hosting provider! Have you considered using YouTube for videos? Just upload them there, and you can embed their player in your pages. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Fri, Apr 10, 2009 at 4:31 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: I know of no way you can do this. Not only would any potential solution be too slow, but it would affect other users of the server, and more than likely result in an email from you hosting provider! Have you considered using YouTube for videos? Just upload them there, and you can embed their player in your pages. Some people have private videos, and that would require Youtube to have an API, otherwise he would have to say hey, go here and upload your videos and then paste your link! What do you mean I know of no way you can do this ? I've got two different styles of installation doing video conversions on two platforms with cronjobs controlling them using system() calls through PHP to ffmpeg. One of them uses ffmpeg-php to identify the source file ahead of time to try to get basic info like the dimensions and aspect ratio and such so when it does it's long ffmpeg command line it puts in some extra parameters to make the conversion work well... I have a 3 webserver cluster that does nginx+php-fpm+up to one convert job at a time and there is no noticable impact to my end users. In fact, I'm looking to replace them with slightly beefier machines so the convert jobs can move faster and I have more resources available in general... What I had meant is I am not sure ffmpeg-php has enough of the API and functions available to do a proper conversion, which is why I recommended using system() for now. It would be major brownie points for someone to beef up ffmpeg-php and add in things like mp4box, neroAacEnc and other conversion tools all into PHP API calls with appropriate return values, I try to stay away from system() calls if I can; also, the imagick PECL extension dumps core files too often (on an unrelated note) and that could use some additional help too. I would love to pool some money together to sponsor some stuff like that. I dislike having to use system() for my imagemagick calls as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Fri, 2009-04-10 at 09:01 -0700, Michael Shadle wrote: On Fri, Apr 10, 2009 at 4:31 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: I know of no way you can do this. Not only would any potential solution be too slow, but it would affect other users of the server, and more than likely result in an email from you hosting provider! Have you considered using YouTube for videos? Just upload them there, and you can embed their player in your pages. Some people have private videos, and that would require Youtube to have an API, otherwise he would have to say hey, go here and upload your videos and then paste your link! What do you mean I know of no way you can do this ? I've got two different styles of installation doing video conversions on two platforms with cronjobs controlling them using system() calls through PHP to ffmpeg. One of them uses ffmpeg-php to identify the source file ahead of time to try to get basic info like the dimensions and aspect ratio and such so when it does it's long ffmpeg command line it puts in some extra parameters to make the conversion work well... I have a 3 webserver cluster that does nginx+php-fpm+up to one convert job at a time and there is no noticable impact to my end users. In fact, I'm looking to replace them with slightly beefier machines so the convert jobs can move faster and I have more resources available in general... What I had meant is I am not sure ffmpeg-php has enough of the API and functions available to do a proper conversion, which is why I recommended using system() for now. It would be major brownie points for someone to beef up ffmpeg-php and add in things like mp4box, neroAacEnc and other conversion tools all into PHP API calls with appropriate return values, I try to stay away from system() calls if I can; also, the imagick PECL extension dumps core files too often (on an unrelated note) and that could use some additional help too. I would love to pool some money together to sponsor some stuff like that. I dislike having to use system() for my imagemagick calls as well. If you'll note, the original question was to find a way which did not require ffmpeg. I should really have rephrased that to say I know of no way you can do this without ffmpeg. I've used ffmpeg and mencoder myself to transcode videos to flv, but in environments where I had full control over the server. Short of moving servers (or at least moving this part of the work to another server) I see no clear way to do it. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Fri, Apr 10, 2009 at 9:12 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: If you'll note, the original question was to find a way which did not require ffmpeg. I should really have rephrased that to say I know of no way you can do this without ffmpeg. I've used ffmpeg and mencoder myself to transcode videos to flv, but in environments where I had full control over the server. Short of moving servers (or at least moving this part of the work to another server) I see no clear way to do it. I think in the original question (I have it deleted now) he didn't say he didn't have access to it, but later he did. Then I kinda just veered off into general discussion about it. There -are- API-based services for video transcoding. They're all PPV (pay-per-view) so you pay for how much you use... - Softlayer offers it to customers (http://www.softlayer.com) - it would be a very fast transfer too as you'd be on the same network as the conversion servers - http://www.gomediaplug.com/ appears to leverage EC2 itself - http://www.multicastmedia.com/solutions/eat.php Transcoding as a service Also, the OP could leverage Amazon's EC2 and make an encoding farm (all depending on budget) - again it is PPV too, so it will only charge for how much he actually needs. Isn't utility computing great? (Or just install Ubuntu/some OS yourself and setup ffmpeg on your EC2 boxes yourself) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
there are shared-host that have ffmpeg like http://www.cirtexhosting.com/shared.shtml tom_a_sparks Please avoid sending me Word or PowerPoint attachments. but instead use OpenDocument File Formats or use OpenOffice http://en.wikipedia.org/wiki/OpenDocument http://en.wikipedia.org/wiki/OpenOffice.org http://www.gnu.org/philosophy/no-word-attachments.html --- On Thu, 9/4/09, Gevorg Harutyunyan gevorg...@gmail.com wrote: From: Gevorg Harutyunyan gevorg...@gmail.com Subject: Re: [PHP] convert video files to FLV To: Adrian adr...@planetcoding.net Cc: php-general@lists.php.net Received: Thursday, 9 April, 2009, 3:45 PM Thanks guys, but as I understood that extension also requires ffmpeg on server, correct me if I am wrong. So anyway I need ffmpeg on server. Some day, when I will have dedicated server I will use ffmpeg for sure, but now I need other solution. On Thu, Apr 9, 2009 at 10:33 AM, Adrian adr...@planetcoding.net wrote: Don't waste CPU power of shared servers for video recoding. If you need that, get a dedicated server without other customers who would probably be affected by you using lots of cpu power. Besides that, if you cannot install own (compiled) software on it, you'd have to use a pure php solution which would be HORRIBLY slow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Best Regards, Gevorg Harutyunyan The new Internet Explorer 8 optimised for Yahoo!7: Faster, Safer, Easier. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert video files to FLV
Hi, I need to convert video files to FLV using php. The only solution that I found is to use ffmpeg, but because I am using shared hosting I am not allowed to install it on server. Do you know any other ways to convert any video file types to flv using PHP. Thanks for help! Best Regards, Gevorg Harutyunyan
Re: [PHP] convert video files to FLV
Don't waste CPU power of shared servers for video recoding. If you need that, get a dedicated server without other customers who would probably be affected by you using lots of cpu power. Besides that, if you cannot install own (compiled) software on it, you'd have to use a pure php solution which would be HORRIBLY slow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Wed, Apr 8, 2009 at 10:30 PM, Gevorg Harutyunyan gevorg...@gmail.com wrote: Hi, I need to convert video files to FLV using php. The only solution that I found is to use ffmpeg, but because I am using shared hosting I am not allowed to install it on server. Do you know any other ways to convert any video file types to flv using PHP. use ffmpeg. there is an ffmpeg-php extension but it's kinda buggy and i am not sure it supports enough for what you want. but using ffmpeg for it is pretty simple. just system() the calls to it. google for it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
On Wed, Apr 8, 2009 at 10:33 PM, Adrian adr...@planetcoding.net wrote: Don't waste CPU power of shared servers for video recoding. If you need that, get a dedicated server without other customers who would probably be affected by you using lots of cpu power. Besides that, if you cannot install own (compiled) software on it, you'd have to use a pure php solution which would be HORRIBLY slow. i use php-fpm + nginx + have one allowed job per server for each of my webservers. dual core with 2 gigs of ram and normal sata disk. no real problems to complain about sharing the two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert video files to FLV
Thanks guys, but as I understood that extension also requires ffmpeg on server, correct me if I am wrong. So anyway I need ffmpeg on server. Some day, when I will have dedicated server I will use ffmpeg for sure, but now I need other solution. On Thu, Apr 9, 2009 at 10:33 AM, Adrian adr...@planetcoding.net wrote: Don't waste CPU power of shared servers for video recoding. If you need that, get a dedicated server without other customers who would probably be affected by you using lots of cpu power. Besides that, if you cannot install own (compiled) software on it, you'd have to use a pure php solution which would be HORRIBLY slow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Best Regards, Gevorg Harutyunyan
Re: [PHP] convert video files to FLV
there's some third party encoding services out there, and if you host with softlayer, they have media transcoding services they offer for their hosting customers (not sure the cost, but it's pay for what you use) On Wed, Apr 8, 2009 at 10:45 PM, Gevorg Harutyunyan gevorg...@gmail.com wrote: Thanks guys, but as I understood that extension also requires ffmpeg on server, correct me if I am wrong. So anyway I need ffmpeg on server. Some day, when I will have dedicated server I will use ffmpeg for sure, but now I need other solution. On Thu, Apr 9, 2009 at 10:33 AM, Adrian adr...@planetcoding.net wrote: Don't waste CPU power of shared servers for video recoding. If you need that, get a dedicated server without other customers who would probably be affected by you using lots of cpu power. Besides that, if you cannot install own (compiled) software on it, you'd have to use a pure php solution which would be HORRIBLY slow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Best Regards, Gevorg Harutyunyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert CMYK values to RGB values?
Anyone know how to convert CMYK values to RGB values? I'm just trying to translate the numbers from one to the other, not actually do any graphic stuff. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
Short Answer: You can't. :-) http://en.wikipedia.org/wiki/CMYK Long Answer: You probably can, but not in some way that makes sense to discuss here on PHP-general. The external links in the above article should get you started. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
I think your short answer is the right one. This explains why I didn't find that cmyk_to_rgb() function on php.net. Thanks... :-( On Jan 9, 2009, at 3:14 PM, c...@l-i-e.com wrote: Short Answer: You can't. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
I found a function on phpbuilder.com but can't copy it on the iPod keyboard. I did a google on php rbg to cmyk value Bastien Sent from my iPod On Jan 9, 2009, at 6:43 PM, Brian Dunning br...@briandunning.com wrote: I think your short answer is the right one. This explains why I didn't find that cmyk_to_rgb() function on php.net. Thanks... :-( On Jan 9, 2009, at 3:14 PM, c...@l-i-e.com wrote: Short Answer: You can't. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
c...@l-i-e.com wrote: Short Answer: You can't. :-) http://en.wikipedia.org/wiki/CMYK Long Answer: You probably can, but not in some way that makes sense to discuss here on PHP-general. The external links in the above article should get you started. May not always come out with the best colors, but the rough formula is: Black = minimum(1-Red,1-Green,1-Blue) Cyan= (1-Red-Black)/(1-Black) Magenta = (1-Green-Black)/(1-Black) Yellow = (1-Blue-Black)/(1-Black) Write your own little functions to convert. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
Have you looked here? http://www.google.com/custom?domains=www.phpclasses.orgq=cmyk+to+rgbsa=Searchsitesearch=www.phpclasses.orgclient=pub-2951707118576741forid=1channel=5742870948ie=ISO-8859-1oe=ISO-8859-1cof=GALT%3A%23663399%3BGL%3A1%3BDIV%3A%2322%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AA3C5CC%3BLBGC%3AA3C5CC%3BALC%3AFF%3BLC%3AFF%3BT%3A00%3BGFNT%3AFF%3BGIMP%3AFF%3BLH%3A50%3BLW%3A256%3BL%3Ahttp%3A%2F%2Ffiles.phpclasses.org%2Fgraphics%2Fgooglesearch.jpg%3BS%3Ahttp%3A%2F%2Fwww.phpclasses.org%2Fsearch.html%3BFORID%3A1%3Bhl=en Without looking at any of their code, I do notice that some class descriptions look promising. John Corry On Fri, Jan 9, 2009 at 8:03 PM, Shawn McKenzie nos...@mckenzies.net wrote: c...@l-i-e.com wrote: Short Answer: You can't. :-) http://en.wikipedia.org/wiki/CMYK Long Answer: You probably can, but not in some way that makes sense to discuss here on PHP-general. The external links in the above article should get you started. May not always come out with the best colors, but the rough formula is: Black = minimum(1-Red,1-Green,1-Blue) Cyan= (1-Red-Black)/(1-Black) Magenta = (1-Green-Black)/(1-Black) Yellow = (1-Blue-Black)/(1-Black) Write your own little functions to convert. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php