Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread cajbecu
function stransform($string) { for ($i=0;$ilength($string);$i++) { $data .= #.ord(substr($string,$i,1)).;; } return $data; } Juanjo Pascual wrote: Do you know any way to convert any string to ascii characters?? I mean: *abcdefgh* to

Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread Juanjo Pascual
Ok. Thanks. You only have to change the function *length() *by the function *strlen()* cajbecu escribió: function stransform($string) { for ($i=0;$ilength($string);$i++) { $data .= #.ord(substr($string,$i,1)).;; } return $data; } Juanjo Pascual wrote: Do you know

Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread cajbecu
That`s true, my mistake.. (length is in pascal) cheers, Juanjo Pascual wrote: Ok. Thanks. You only have to change the function *length() *by the function *strlen()* cajbecu escribió: function stransform($string) { for ($i=0;$ilength($string);$i++) { $data .=

Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-23 Thread Ahmed Saad
On 23/06/06, cajbecu [EMAIL PROTECTED] wrote: $data .= #.ord(substr($string,$i,1)).;; and I think there's no need for substr.. just $data .= #.$string[$i].;; /ahmed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] String Manipulation

2006-06-05 Thread Chris
Rodrigo de Oliveira Costa wrote: Hi guys I have the following intention and would really like to know if tis possible and if its possible how should it be done. I have a string that is something like this: INPUT TYPE=BUTTON Value='nbsp;nbsp;#171;nbsp;nbsp;'

Re: [PHP] String /pattern formatting extraction question

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 7:40 am, Andy wrote: Hi to all, I have the following pattern for a string: text1 /ptext2 /otext3 Now, I want to extract the text by patterns from this string by the following rule: no pattern - text1 (what is before /o or /p) /p - text2 (what is after /p) /o -

RE: [PHP] String is not zero-terminated

2006-04-10 Thread Kristen G. Thorson
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, April 10, 2006 4:44 PM To: php-general@lists.php.net Subject: [PHP] String is not zero-terminated In order to attempt to figure out why my script segfaults PHP (5.0.4, 5.1.2, 5.1.3RC3) I've been compiling

RE: [PHP] String is not zero-terminated

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 4:40 pm, Kristen G. Thorson wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, April 10, 2006 4:44 PM To: php-general@lists.php.net Subject: [PHP] String is not zero-terminated In order to attempt to figure out why my script

Re: [PHP] String is not zero-terminated

2006-04-10 Thread Curt Zirzow
On Mon, Apr 10, 2006 at 03:43:55PM -0500, Richard Lynch wrote: In order to attempt to figure out why my script segfaults PHP (5.0.4, 5.1.2, 5.1.3RC3) I've been compiling --with-debug That then gives me warnings such as: Run-time warning. String is not zero-terminated () (source:

Re: [PHP] String is not zero-terminated

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 6:14 pm, Curt Zirzow wrote: One thing you might want to check is what is triggering this error, if you are doing a strlen() call this error shouldn't be issued, IMO. If operation you are doing rely's on the terminating \0, it most likely should get fixed in php. I'm

Re: [PHP] string to integer conversion

2006-03-15 Thread Robin Vickery
On 15/03/06, suresh kumar [EMAIL PROTECTED] wrote: i am facing one problem in type casting. $accno=2927; $accno=$accno+1; its o/p is 2928. but i want output to be 2928.i am waiting response from u. $accno = sprintf('%08d', $accno+1); -robin

[PHP] please do my homework for me[was] Re: [PHP] string to integer conversion

2006-03-15 Thread Jochem Maas
suresh kumar wrote: i am facing one problem in type casting. $accno=2927; $accno=$accno+1; its o/p is 2928. but i want output to be 2928.i am my h/t is g/d but if d/l is w/h then I w/s but only if it's g/v waiting response from u. from what I gather your always waiting for a

Re: [PHP] string size in bytes

2006-02-12 Thread Philip Hallstrom
i need to know how many bytes are in a string example: $string = blah; string == how many bytes Well, if you're willing to ignore all the unicode stuff, you can use strlen() since 1 byte = 1 character. Check that manpage to see if there's a unicode safe version. also i need to know how

Re: [PHP] string size in bytes

2006-02-12 Thread Curt Zirzow
On Sun, Feb 12, 2006 at 08:13:42PM -0600, Philip Hallstrom wrote: i need to know how many bytes are in a string example: $string = blah; string == how many bytes Well, if you're willing to ignore all the unicode stuff, you can use strlen() since 1 byte = 1 character. Check that

Re: [PHP] string lenght?

2006-02-06 Thread Richard Davey
On 6 Feb 2006, at 12:18, William Stokes wrote: How can I test whether a string is 1 or 2 digits long? Cast it to an int (or float if required) and strlen() it. Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services -- PHP General Mailing List

Re: [PHP] string lenght?

2006-02-06 Thread William Stokes
Cheers! Richard Davey [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] On 6 Feb 2006, at 12:18, William Stokes wrote: How can I test whether a string is 1 or 2 digits long? Cast it to an int (or float if required) and strlen() it. Cheers, Rich -- http://www.corephp.co.uk Zend

RE: [PHP] String Validation / SQL Injection Vulnerbilities

2005-12-05 Thread Jay Blanchard
[snip] I want to validate a string for storage into a database so that it cannot contain any content that might be interpreted as SQL, Javascript, PHP, etc. Is there a standard function or technique to perform this validation? [/snip] The technique is regex (regular expressions), start here

Re: [PHP] String Validation / SQL Injection Vulnerbilities

2005-12-05 Thread Curt Zirzow
On Mon, Dec 05, 2005 at 02:00:13PM -0500, Michael B Allen wrote: I want to validate a string for storage into a database so that it cannot contain any content that might be interpreted as SQL, Javascript, PHP, etc. Is there a standard function or technique to perform this validation? Trying to

Re: [PHP] string tokenization

2005-09-13 Thread Luis Magaña
Git the first set of tokens to an array, then walk that array retrieving the subtokens. Regards babu wrote: Hi, I have different types of main strings seperated by commas(,). I want to tokenize the main string using php's string token function. I have substrings in the main string which

Re: [PHP] String format problem

2005-09-01 Thread Mark Rees
In fact, this is a poor example since the difference gets larger with longer string and more arguments. When you use dots, the interpreter has to actually concatenate the string, looking for memory to do so and freeing it up afterwards. This takes time. With commas, each argument is sent to

RE: [PHP] String format problem

2005-09-01 Thread Ford, Mike
On 31 August 2005 16:56, [EMAIL PROTECTED] wrote: $varname = '$firstname $lastname told me to find the file in folder C:\newtext\'; echo $varname; Yields.. $firstname $lastname told me to find the file in folder C:\newtext\ Actually, that'll give you an error as well, since \' is also

Re: [PHP] String format problem

2005-09-01 Thread tg-php
Wow! Fantastic rundown Satyam! Thanks for posting such a complete analysis. I had no idea that you could use commas instead of periods to join multiple strings much less do it without concatinating, that's very interesting. I don't think I've ever seen that used in any sample code before.

Re: [PHP] String format problem

2005-09-01 Thread Oliver Grätz
Please keep in mind you are speaking about microseconds of performance improvements. Optimising on this level is complete and utter nonsense. Using output buffering may give your application a much higher performance boost. And then you can still use a cache (opcode cache, page cache, ...) which

Re: [PHP] String format problem

2005-08-31 Thread Robin Vickery
On 8/31/05, Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote: hi i have a problem when i am formating a string the problem is it converts the \n in the string to a new line here is the code ? $Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub; $Replace =

Re: [PHP] String format problem

2005-08-31 Thread Philip Hallstrom
hi i have a problem when i am formating a string the problem is it converts the \n in the string to a new line here is the code ? $Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub; $Replace = D:\AppServ\www\intranet\admin\store; $with = http://localhost/bank/admin/store;; //$doc =

Re: [PHP] String format problem

2005-08-31 Thread tg-php
To elaborate on Philip's response (which is correct)... Anything in double quotes ( ) will be interpreted by PHP before figuring out what the actual value is. Items like \n, \t, etc are therefore converted to a newline (\n) or a tab (\t) before assigning to the variable. Variables within

Re: [PHP] String format problem

2005-08-31 Thread Satyam
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To elaborate on Philip's response (which is correct)... [] I've read never use double quotes unless you have to because it could potentially speed up PHP a little because it won't be trying to interpret every string. I once

RE: [PHP] String format problem

2005-08-31 Thread Jim Moseby
hi i have a problem when i am formating a string the problem is it converts the \n in the string to a new line here is the code ? $Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub; $Replace = D:\AppServ\www\intranet\admin\store; $with = http://localhost/bank/admin/store;; Use

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? p.s. While I would be interested in possible alternative solutions, I would like to know how to accomplish

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? p.s. While I would be interested in possible alternative solutions, I would like to

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Jay Blanchard wrote: If you place the string into a variable then you would be able to work with it that way. Using what functions? Part of the point was not to need to keep track of the current location in the string, etc...basically things that streams tend to handle well. There

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] Jay Blanchard wrote: If you place the string into a variable then you would be able to work with it that way. Using what functions? Part of the point was not to need to keep track of the current location in the string, etc...basically things that streams tend

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Again, I would like to treat the string as a stream. One possible way to accomplish this would be to simply write the string to a temporary file, open the file with fopen and then use fscanf, fseek, etc. to process the text. However, I am assuming there is an easier way (i.e. a method

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: What, exactly, do you want to accomplish? I want to be able to treat a string as a stream. For example, the C++ STL contains istringstream, which allows one to treat strings as streams. (http://www.cplusplus.com/ref/iostream/istringstream/) If you are truly wondering

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Jay Blanchard wrote: What, exactly, do you want to accomplish? I want to be able to treat a string as a stream. [/snip] I know C++ and I know what you are talking about here. As I said before, you would have pretty high overhead to do this in PHP. However, if I know what you want to do

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: However, if I know what you want to do with the string more specifically (I asked for examples, which you have not given) I can get you to the right PHP functions. I am familiar with all of the PHP string functions. PHP does not have a class or function similar to

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Neither solution was particularly appealing which is why I asked the question. [/snip] I see. Sorry I couldn't be more helpful. And I thought you wore looking for a more precise function rather than the whole lot of things that can be accomplished with isstringstream. -- PHP General

RE: [PHP] String to Stream

2005-08-05 Thread Michael Sims
Eric Gorr wrote: Again, I would like to treat the string as a stream. One possible way to accomplish this would be to simply write the string to a temporary file, open the file with fopen and then use fscanf, fseek, etc. to process the text. However, I am assuming there is an easier way

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] Neither solution was particularly appealing which is why I asked the question. [/snip] I see. Sorry I couldn't be more helpful. And I thought you wore looking for a more precise function rather than the whole lot of things that can be accomplished with

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Looks like it wouldn't be terribly difficult to get something like this up and running. I was just taking a look at: http://us3.php.net/manual/en/function.stream-wrapper-register.php I'm kinda surprised no one has written a wrapper for strings yet... [/snip] Perhaps because there is

Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: This should be a fairly easy question for someone who already knows the answer... What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how?

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jochem Maas wrote: http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those built in string functions :-) And

Re: [PHP] String to Stream

2005-08-05 Thread Miles Thompson
But WHY WHY WHY would one want to treat a string as a stream, when PHP has such good string handling functions? THATS not been explained. (Unless, knowing C and its limited string handling capabilities, one is looking for a familiar hammer.) It's Friday - time to go socialize - Miles PS

Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: Jochem Maas wrote: http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those built in string

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jochem Maas wrote: Eric Gorr wrote: Jochem Maas wrote: http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Well, as I mentioned before, you are welcome to look into the surrounding useful examples for istringstream, etc. I can't think of a single reason why similar reasons why istringstream, etc. is useful would not apply to a php stream_wrapper for strings. As for why things like

Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: Jochem Maas wrote: Eric Gorr wrote: Jochem Maas wrote: http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason

Re: [PHP] String with front slashes.....

2005-07-19 Thread John Nichel
Jay Blanchard wrote: I have the potential for strings where the string will contain a front slash; index_Foo_Communications_c/o_Bar_Enterprises_20050718 I want to use the string to name a text file index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt but it always fails to open the file

RE: [PHP] String with front slashes.....

2005-07-19 Thread Jay Blanchard
[snip] I'd say it would be best to keep that slash out of the filename. Do a regex on the string before doing anything else preg_replace ( /\//, -, $string ); [/snip] That is what I ultimately told them, Don't do that. Of course they looked at me like I was a space alien (which I am today,

Re: [PHP] String with front slashes.....

2005-07-19 Thread John Nichel
Jay Blanchard wrote: snip BTW, my daughter got her learner's permit today! Damn, you're old. ;) I only have a 5yoso that must mean I'm still in my 20's, right? Right? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List

RE: [PHP] String with front slashes.....O T

2005-07-19 Thread Jay Blanchard
[snip] BTW, my daughter got her learner's permit today! Damn, you're old. ;) [/snip] You sure you want to say that today? I started late too, most of my high school friends had their children starting in their 20's ...I was into my 30's. She is my only child though. [snip] I only have a

Re: [PHP] String manipulation out of the box solution?

2005-05-11 Thread Merlin
Richard Lynch wrote: On Tue, May 10, 2005 5:58 am, Merlin said: I am writing an internal full text search engine and do have trouble in outputting the text in an apropriate way. Problem is that if there is more than one word I cant handle the text cropping. For example: Search term: php germany

Re: [PHP] String manipulation out of the box solution?

2005-05-10 Thread Richard Lynch
On Tue, May 10, 2005 5:58 am, Merlin said: I am writing an internal full text search engine and do have trouble in outputting the text in an apropriate way. Problem is that if there is more than one word I cant handle the text cropping. For example: Search term: php germany Text from

Re: [PHP] String format best practice

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 1:27 pm, René Fournier said: I need to output a Hex value, e.g.: 686E8AF8 In the following format: 68 6E 8A F8 In other words, separated by spaces. Now I realize there are a million ways to do this, but I would like a suggestion on which you think is the most

RE: [PHP] String format best practice

2005-03-29 Thread Jared Williams
I need to output a Hex value, e.g.: 686E8AF8 In the following format: 68 6E 8A F8 In other words, separated by spaces. Now I realize there are a million ways to do this, but I would like a suggestion on which you think is the most efficient? Incidentally, I'm starting

Re: [PHP] String validation

2005-02-23 Thread Bostjan Skufca @ domenca.com
or if you aren't into regex (which I find confusing and still am trying to learn): Read the book Mastering Regular Expressions or first 300 pages of it - trust me, it is worth the labour (personal experience)! On Wednesday 23 February 2005 07:44, Ligaya Turmelle wrote: if

Re: [PHP] String validation

2005-02-22 Thread John Holmes
Ashley M. Kirchner wrote: How can I check that a string is no more than 6 characters long and only contains alpha characters (no numbers, spaces, periods, hyphens, or anything else, just letters.) if(preg_match('/^[a-zA-Z]{0,6}$/',$string)) { echo 'good'; } else { echo 'bad'; } Change to

Re: [PHP] String validation

2005-02-22 Thread Ligaya Turmelle
or if you aren't into regex (which I find confusing and still am trying to learn): if ((strlen(trim($string)) =6) ctype_alpha(trim($string))) { echo 'good'; } else { echo 'bad'; } John Holmes wrote: Ashley M. Kirchner wrote: How can I check that a string is no more than 6 characters long

RE: [PHP] String - Number Automatic Conversion

2005-02-04 Thread Ford, Mike
On 03 February 2005 19:40, Nuzzo Art-CINT116 wrote: Is this a bug or am I missing something. It's a bug -- see http://bugs.php.net/bug.php?id=30726 Reported fixed on 18-Jan-2005, so I guess you're looking at 4.3.11/5.0.4 to actually contain the fix. Are there patches

Re: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Richard Lynch
Nuzzo Art-CINT116 wrote: 1 = -.15 + 0, 6 = -1.15 + 0, [1] = 0 [6] = -1.15 Is this a bug or am I missing something. Looks like a bug to me... It's remotely possible that it's documented somewhere that -.15 doesn't turn into a number, but that would be

RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Nuzzo Art-CINT116
Possible work-around: I suspect that $p1[14] = -0.15 + 0; will do what you want, since the leading 0 will probably trigger the regex properly. Try it and see. Changing it to -0.15 + 0 works. This data is actually coming from a numeric field in an Oracle database using the OCI

RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Richard Lynch
Nuzzo Art-CINT116 wrote: Possible work-around: I suspect that $p1[14] = -0.15 + 0; will do what you want, since the leading 0 will probably trigger the regex properly. Try it and see. Changing it to -0.15 + 0 works. This data is actually coming from a numeric field in an Oracle database

RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Ford, Mike
On 03 February 2005 16:07, Nuzzo Art-CINT116 wrote: I am not sure if this is a bug or I am just doing something dumb but I am having a problem with automatic converting of strings to a number between 0 and -1. For example: 1 = -.15 + 0, [1] = 0 Is this a bug or am I

RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Nuzzo Art-CINT116
Is this a bug or am I missing something. It's a bug -- see http://bugs.php.net/bug.php?id=30726 Reported fixed on 18-Jan-2005, so I guess you're looking at 4.3.11/5.0.4 to actually contain the fix. Cheers! Mike

RE: Re: [PHP] String to Date and Date to String Functions?

2005-01-25 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 25 January 2005 00:25, Ben Edwards wrote: On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike [EMAIL PROTECTED] wrote: To view the terms under which this email is distributed,

RE: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jay Blanchard
[snip] Being trying to work out haw to handle dates. Basically I need a function to convert a Date to a String and another function to convert a string to a date. Exactly what format the date is held in is not relevant as long as it is some type of standard (i.e. Unix Timestamps). Both the

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] String to Date Function return date stringToDate( str Date, str Format ) e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); Date to String Function

Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread hitek
How about the strtotime() function? http://us4.php.net/manual/en/function.strtotime.php From: Ben Edwards [EMAIL PROTECTED] Date: 2005/01/24 Mon PM 12:03:34 EST To: Jay Blanchard [EMAIL PROTECTED] CC: PHP General List php-general@lists.php.net Subject: Re: [PHP] String to Date and Date

Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
, validate it, and then convert it back to a timestamp. I cant beleve the PHP date/time functions suck this bad;( Ben From: Ben Edwards [EMAIL PROTECTED] Date: 2005/01/24 Mon PM 12:03:34 EST To: Jay Blanchard [EMAIL PROTECTED] CC: PHP General List php-general@lists.php.net Subject: Re: [PHP

RE: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 24 January 2005 17:04, Ben Edwards wrote: On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] String to Date Function

RE: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jay Blanchard
[snip] On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How about the strtotime() function? http://us4.php.net/manual/en/function.strtotime.php No good, it douse not take a format string. What if I wanted to convert the timestamp to 'DD-MM-YYY', display it on a

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Bret Hughes
On Mon, 2005-01-24 at 11:03, Ben Edwards wrote: On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] String to Date Function return date stringToDate( str Date, str Format ) e.g. $todayDt = stringToDate(

RE: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 24 January 2005 19:01, Ben Edwards wrote: On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How about the strtotime() function?

Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Richard Lynch
Ben Edwards wrote: On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How about the strtotime() function? http://us4.php.net/manual/en/function.strtotime.php No good, it douse not take a format string. What if I wanted to convert the timestamp to 'DD-MM-YYY',

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 19:22:40 -, Ford, Mike [EMAIL PROTECTED] wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 24 January 2005 17:04, Ben Edwards wrote: On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard

Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 13:32:36 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How about the strtotime() function? http://us4.php.net/manual/en/function.strtotime.php No good, it douse not take a format

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jason Wong
On Tuesday 25 January 2005 08:07, Ben Edwards wrote: As I have said in a previous email to date function takes a format string and the strtodate douse not. Therefore the strtodate() only works on a small subset of what date() can produce. The format I am interested in is DD-MM- which is

Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike [EMAIL PROTECTED] wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 24 January 2005 19:01, Ben Edwards wrote: On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED]

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jason Wong
On Tuesday 25 January 2005 08:09, Ben Edwards wrote: Well, you could always write some extensions to PHP to cover it, as soon as you learn to spell does :) That is awfull grammer. Ime dyslexic, whats your excuse. Does is spelt 'does' not 'douse', that grammar looks OK to me. Was

Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Rick Fletcher
Ben Edwards wrote: The format I am interested in is DD-MM- which is the way dates are specified in the UK, strtodate() cant handle this. Ben, there is no (built in) string-timestamp function that takes a format. strtotime() is pretty smart about interpreting your input, but it's limited to

Re: [PHP] String replace inside img

2005-01-07 Thread Jason Wong
On Friday 07 January 2005 07:32, Fredrik Arild Takle wrote: I have a some problems doing a search and replace in a string. I want to replace: img ALT= src=base/image.php?id=3 border=0 with img ALT= src=image.php?id=3 border=0 Note ALT, src, border properties may come in random order. My

RE: [PHP] String: Arrays of arrays.

2004-12-23 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 23 December 2004 07:39, Song Ken Vern-E11804 wrote: Hi, I have an array of array of strings :- $g1 = array(453, 592); $g2 = array(e14, e15, e13); $groups = array($g1,

Re: [PHP] String: Arrays of arrays.

2004-12-23 Thread Jason Wong
On Thursday 23 December 2004 15:39, Song Ken Vern-E11804 wrote: print !--=$groups[$i][$j]=--\n; /* line?? */ to include :- $cid = $groups[$i][$j]; print !--=$cid=--\n; /* line?? */ I seem to get the results I want. Why is this? Is there a syntax error? You need to change it to this:

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-22 Thread Jason Wong
On Wednesday 22 December 2004 08:18, John Holmes wrote: It is, I guess. ?php $a = ' ? '; $b = ' ? '; ? will work just fine. If you try to comment out either line, though, the PHP processing will end at the ? and spit out the rest as plain text. So, text can have as many ? as you want

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-22 Thread Curt Zirzow
* Thus wrote Jason Wong: On Wednesday 22 December 2004 08:18, John Holmes wrote: It is, I guess. ?php $a = ' ? '; $b = ' ? '; ? will work just fine. If you try to comment out either line, though, the PHP processing will end at the ? and spit out the rest as plain text. So,

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-22 Thread Richard Lynch
Jason Wong wrote: On Wednesday 22 December 2004 03:53, Richard Lynch wrote: ? can be caught by PHP as the end of PHP mode, no matter where you put it in a string or not. You can't be serious? Or have I misunderstood you? ?php echo '?php ?'; ? Works as expected, ie displays ?php ?.

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread John Holmes
From: Steve Brown [EMAIL PROTECTED] Unexpected results: If line 16 (indicated below) is commented out, the '?' in the string on line 17 makes PHP stop parsing and the rest of the script is simply dumped to stdout. If line 16 is NOT commented out, the '?' is NOT picked up as being a PHP tag

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread Jason Wong
On Wednesday 22 December 2004 01:12, Steve Brown wrote: I'm working on a script that will parse through a long string using regexs to pattern match a certain format. I'm having an issue with a '?' in a string being picked up as an end-of-code character, but only if the line before it is

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread Steve Brown
Quote: The one-line comment styles actually only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after // ? WILL be printed: ? skips out of the PHP mode and returns to HTML mode, and // cannot influence that. If asp_tags

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread Richard Lynch
Steve Brown wrote: I'm working on a script that will parse through a long string using regexs to pattern match a certain format. I'm having an issue with a '?' in a string being picked up as an end-of-code character, but only No need to run it. ? can be caught by PHP as the end of PHP mode,

Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread Jason Wong
On Wednesday 22 December 2004 03:53, Richard Lynch wrote: ? can be caught by PHP as the end of PHP mode, no matter where you put it in a string or not. You can't be serious? Or have I misunderstood you? ?php echo '?php ?'; ? Works as expected, ie displays ?php ?. -- Jason Wong - Gremlins

Re: Re: [PHP] String parsing issue in PHP 4.3.10?

2004-12-21 Thread John Holmes
You will notice that the previous line also contains a '?' sequence, so I'm confused as to why this would die on one line but not the other? Or is this some freak combination of comments and PHP tags? :-o It is, I guess. ?php $a = ' ? '; $b = ' ? '; ? will work just fine. If you try

Re: [PHP] string filtering

2004-08-27 Thread Aaron (phpc)
John W. Holmes wrote: To detect them: if(preg_match('/[^0-9a-zA-Z]/',$string)) { echo 'bad characters present'; } else { echo 'string okay'; } or (faster): if (!ctype_alnum($string)){ echo 'bad characters present'; } else { echo 'string okay'; } Aaron -- PHP General Mailing List

RE: [PHP] String compare of 7 text strings

2004-08-14 Thread Ford, Mike [LSS]
-Original Message- From: Brent Clements To: [EMAIL PROTECTED] I wanted to see if anyone has an easier way to do this. The end result is this: I need to compare 7 different text strings(which are in an array). They should all be the same, if they are not the same, a message should be

Re: [PHP] String compare of 7 text strings

2004-08-14 Thread Hannes Magnusson
if ( count ( array_unique ( $array ) ) == 1 ) { // all fields have the same value } we could post solution to this problem for ever... - Hannes On Sat, 14 Aug 2004 15:24:03 +0100 [EMAIL PROTECTED] (Mike Ford) wrote: -Original Message- From: Brent Clements To: [EMAIL PROTECTED] I

Re: [PHP] String compare of 7 text strings

2004-08-14 Thread Kim Steinhaug
* Ed Lazor wrote : Nice solution =) My thoughts exatly, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't.

Re: [PHP] String compare of 7 text strings

2004-08-14 Thread Jason Wong
On Saturday 14 August 2004 23:12, Hannes Magnusson wrote: if ( count ( array_unique ( $array ) ) == 1 ) { // all fields have the same value } we could post solution to this problem for ever... Indeed: if (count(array_flip($doo)) 1) { // not same } -- Jason Wong - Gremlins Associates -

Re: [PHP] String compare of 7 text strings

2004-08-14 Thread Hannes Magnusson
if ( count ( array_diff ( $array, array ( $array[0] ) ) 0 ) { // not same } On Sun, 15 Aug 2004 00:24:30 +0800 [EMAIL PROTECTED] (Jason Wong) wrote: On Saturday 14 August 2004 23:12, Hannes Magnusson wrote: if ( count ( array_unique ( $array ) ) == 1 ) { // all fields have the same value

Re: [PHP] String compare of 7 text strings

2004-08-13 Thread Brent Clements
Let me rephase my question in my previous email: I'd like to compare 7 strings(which are in an array). Each string should be the same, if they are not, a message should be outputted. How would one do this outside of using a huge if/then statement? Thanks, Brent - Original Message -

Re: [PHP] String compare of 7 text strings

2004-08-13 Thread Hannes Magnusson
sort ( $array ); if ( $array[ 0 ] !== $array[ count ( $array )-1 ] ) { // Not all fields in the array are the same... } On Fri, 13 Aug 2004 21:10:50 -0500 [EMAIL PROTECTED] (Brent Clements) wrote: Let me rephase my question in my previous email: I'd like to compare 7 strings(which are in

<    1   2   3   4   5   >