Re: [PHP] Re: array or list of objects of different types

2010-04-02 Thread Nilesh Govindarajan
On 04/03/10 05:42, Nathan Rixham wrote: Php Developer wrote: Hi all, I want to be able to have an array of elements of different types. As an example: the first element is a boolean, the second is an integer, and the thirs is a string. In php there is no typing, i'm just wondering if there i

Re: [PHP] Re: convert a string into an array

2010-04-02 Thread Nilesh Govindarajan
On 04/03/10 04:56, Nathan Rixham wrote: 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

[PHP] Re: array or list of objects of different types

2010-04-02 Thread Nathan Rixham
Php Developer wrote: > Hi all, > > I want to be able to have an array of elements of different types. As an > example: the first element is a boolean, the second is an integer, and the > thirs is a string. > > In php there is no typing, i'm just wondering if there is a way to have that, > it w

[PHP] array or list of objects of different types

2010-04-02 Thread Php Developer
Hi all, I want to be able to have an array of elements of different types. As an example: the first element is a boolean, the second is an integer, and the thirs is a string. In php there is no typing, i'm just wondering if there is a way to have that, it would be a lot better than having an a

Re: [PHP] preg_match? Or something else?

2010-04-02 Thread Nathan Rixham
Jim Lucas wrote: > Ashley M. Kirchner wrote: >> I have an array that's created as follows: >> >> >> >> $string = "73G146C 311- 309.1C"; >> >> >> Anyone want to take a stab at it? >> >> > > Conditionals are your friend! > > > $string = "73G146C 311- 309.1C"; > > $arr = pre

Re: [PHP] preg_match? Or something else?

2010-04-02 Thread Jim Lucas
Ashley M. Kirchner wrote: > I have an array that's created as follows: > > > > $string = "73G146C 311- 309.1C"; > > $arr = preg_split("/[\s]+/", $string); > > > > Now I need to take each element in that array, and break them up even > further so that I get: > > > > 73G=>

[PHP] Re: convert a string into an array

2010-04-02 Thread Nathan Rixham
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 > m

Re: [PHP] convert a string into an array

2010-04-02 Thread Jim Lucas
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 > m

[PHP] preg_match? Or something else?

2010-04-02 Thread Ashley M. Kirchner
I have an array that's created as follows: $string = "73G146C 311- 309.1C"; $arr = preg_split("/[\s]+/", $string); Now I need to take each element in that array, and break them up even further so that I get: 73G=> "73" and "G" 146C => "146" and "C" 311- => "311" and

[PHP] convert a string into an array

2010-04-02 Thread Andre Polykanine
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 containi

[PHP] SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

2010-04-02 Thread Peter Pei
I use the following code to get rss and parse it, but the code occasionally have issues with gb2312 or big-5 encoded feeds, and fails to parse them. However other times may appear just okay. Any thoughts? Maybe SimpleXMLElement is simply not meant for other language encodings...

[PHP] SimpleXMLElement and gb2312 or big5

2010-04-02 Thread Peter Pei
I use the following code to get rss and parse it, but the code occasionally have issues with gb2312 or big-5 encoded feeds, and fails to parse them. However other times may appear just okay. Any thoughts? Maybe SimpleXMLElement is simply not meant for other language encodings...

Re: [PHP] str_replace help

2010-04-02 Thread Nilesh Govindarajan
On 04/02/10 18:58, David Stoltz wrote: Hi folks, In ASP, I would commonly replace string line feeds for HTML output like this: Var = replace(value,vbcrlf,"") In PHP, the following doesn't seem to work: $var = str_replace(chr(13),"\n",$value) Neither does: $var = str_replace(chr(10),"\n",$valu

Re: [PHP] str_replace help

2010-04-02 Thread Midhun Girish
well david actually $var = str_replace(chr(13),"\n",$value) will replace char(13) with \n... but \n wont come up in html unless u give a tag.. u need to put $var = str_replace(chr(13),"",$value) in order to got the required output Midhun Girish On Fri, Apr 2, 2010 at 7:03 PM, Ashley Sheri

Re: [PHP] str_replace help

2010-04-02 Thread Ashley Sheridan
On Fri, 2010-04-02 at 09:28 -0400, David Stoltz wrote: > Hi folks, > > In ASP, I would commonly replace string line feeds for HTML output like > this: > > Var = replace(value,vbcrlf,"") > > In PHP, the following doesn't seem to work: > $var = str_replace(chr(13),"\n",$value) > > Neither do

[PHP] str_replace help

2010-04-02 Thread David Stoltz
Hi folks, In ASP, I would commonly replace string line feeds for HTML output like this: Var = replace(value,vbcrlf,"") In PHP, the following doesn't seem to work: $var = str_replace(chr(13),"\n",$value) Neither does: $var = str_replace(chr(10),"\n",$value) What am I doing wrong? Thanks!