Re: [PHP] String eval assistance

2011-03-16 Thread Richard Quadling
On 16 March 2011 00:25, Jack jacklistm...@gmail.com wrote:     Here you're trying to access it as an array, which it's not, so the 'response' key doesn't exist.  In addition, you're looking for UPPER-CASE, whereas that's not the case in your example variable. Finally, you're checking to make

Re: [PHP] String eval assistance

2011-03-16 Thread Alex
I'm not sure as to why strpos does what it does here, at least its not immediately obvious, but, a solution to this would be to use a regular expression search, it would be more exact, it has never failed me, and it will be faster; I recall reading that preg functions were faster at then str

Re: [PHP] String eval assistance

2011-03-15 Thread Simon J Welsh
On 16/03/2011, at 10:34 AM, Jack wrote: Hello All, I got some help on this yesterday, but somehow it's not consistant ? $results = 3434approd34; if(strpos($results['response'], 'APPROVED') !== false) { print declined; } else { print approved;

RE: [PHP] String length output in php-generated response

2011-02-07 Thread Ford, Mike
-Original Message- From: Florin Jurcovici [mailto:florin.jurcov...@gmail.com] Sent: 06 February 2011 15:57 I'm trying to build myself a small JSON-RPC server using PHP. Using wireshark, here's the conversation: Request: [...snip...] Response: HTTP/1.1 200 OK

Re: [PHP] String length output in php-generated response

2011-02-07 Thread Richard Quadling
On 6 February 2011 15:57, Florin Jurcovici florin.jurcov...@gmail.com wrote:  said it, Bush junior proved it Is this actually part of the output? -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] String Encodings - loose guidelines

2011-01-28 Thread Donovan Brooke
Marc Guay wrote: 1.) Saving strings to a database One thing I always forget to remember is to send tge SET NAMES utf8 command to MySQL after making a connection. This will save you 1000 headaches if you're working with non-latin characters. I can't count the number of times I've thrown

Re: [PHP] String Encodings - loose guidelines

2011-01-25 Thread Marc Guay
1.) Saving strings to a database One thing I always forget to remember is to send tge SET NAMES utf8 command to MySQL after making a connection. This will save you 1000 headaches if you're working with non-latin characters. I can't count the number of times I've thrown htmlentities,

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-17 Thread Kris Deugau
David Harkness wrote: I've never used the old-style constructors, but perhaps the semantics of parent:: changed and you need to instead use $this- as in $this-Tag(option, $name); That's a total guess. I don't have 5.2 handy to try it out, but both work in 5.3 using a simple example. Can

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-17 Thread Kris Deugau
Nathan Nobbe wrote: 2. try modifying Tag SelectBoxOption to have __construct() instead of Tag() SelectBoxOption(), then call parent::__construct() from inside of SelectBoxOption::__construct(); see if that clears up your problem under 5.2 (read: this will only be a partial solution as it

RE: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Tommy Pham
-Original Message- From: Kris Deugau [mailto:kdeu...@vianet.ca] Sent: Thursday, December 16, 2010 11:57 AM To: php-general@lists.php.net Subject: [PHP] String passed to object constructor turning into an instance of that object? I'm in the process of migrating customer websites

Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Kris Deugau
Tommy Pham wrote: class SelectBoxOption extends Tag { function SelectBoxOption($name, $value, $selected=false) { parent::Tag(option, $name); $this-addAttribute(value, $value); if($selected) { $this-addAttribute(selected, '', false); } if ($name == ) {

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Kris Deugau
Nathan Nobbe wrote: Why not test for the type of $name at each point of interest in the SelectBoxOption constructor? If you're passing a string value to the constructor it almost has to be getting changed by the Tag constructor, right ? class SelectBoxOption extends Tag { function

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 3:21 PM, Kris Deugau kdeu...@vianet.ca wrote: Nathan Nobbe wrote: Why not test for the type of $name at each point of interest in the SelectBoxOption constructor? If you're passing a string value to the constructor it almost has to be getting changed by the Tag

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread David Harkness
It's acting as if Tag's constructor a) declares $name as a reference using $name, and b) is assigning itself ($this) to $name for some (probably bad) reason. That's the only way I can see that $name inside SelectBoxOption's constructor could change from a string to an object. A peek at Tag's

Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Kris Deugau
Nathan Nobbe wrote: probly something screwy going on w/ the old style of naming constructors. 2 things, 1. can you post the Tag constructor as it reads now? function Tag($tag='', $tagContent='') { $this-tagContent = $tagContent; $this-tag = $tag; $this-showEndTag = false;

Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 4:04 PM, Kris Deugau kdeu...@vianet.ca wrote: Nathan Nobbe wrote: probly something screwy going on w/ the old style of naming constructors. 2 things, 1. can you post the Tag constructor as it reads now? function Tag($tag='', $tagContent='') { $this-tagContent

Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread David Harkness
I've never used the old-style constructors, but perhaps the semantics of parent:: changed and you need to instead use $this- as in $this-Tag(option, $name); That's a total guess. I don't have 5.2 handy to try it out, but both work in 5.3 using a simple example. Can you post the constructor

Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 3:21 PM, Kris Deugau kdeu...@vianet.ca wrote: Nathan Nobbe wrote: Why not test for the type of $name at each point of interest in the SelectBoxOption constructor? If you're passing a string value to the constructor it almost has to be getting changed by the Tag

Re: [PHP] String Parse Help for novice

2010-06-14 Thread tedd
At 9:29 PM -0400 6/13/10, Robert Cummings wrote: ?php function my_parse_url( $url ) { $parsed = parse_url( $url ); $parsed['file'] = basename( $parsed['path'] ); $parsed['pathbits'] = explode( '/', ltrim( dirname( $parsed['path'] ), '/' ) ); return $parsed; } $url =

Re: [PHP] String Parse Help for novice

2010-06-14 Thread Robert Cummings
tedd wrote: At 9:29 PM -0400 6/13/10, Robert Cummings wrote: ?php function my_parse_url( $url ) { $parsed = parse_url( $url ); $parsed['file'] = basename( $parsed['path'] ); $parsed['pathbits'] = explode( '/', ltrim( dirname( $parsed['path'] ), '/' ) ); return $parsed; }

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable.

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:13 PM, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable. The problem

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Rick Dwyer
OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string? --Rick On Jun 13, 2010, at 6:23 PM, Ashley

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote: OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string?

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 17:35 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote: OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string?

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:35 -0400, Rick Dwyer wrote: OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:40 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:35 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun,

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Rick Dwyer
OK, sorry for any confusion. Here is all my code: $url = http . ((!empty($_SERVER['HTTPS'])) ? s : ) . ://. $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $thepath = parse_url($url); So, given that the URL can vary as follows: /mydirectory/mysubdirectory/anothersubdirectory/mypage.php vs.

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:52 -0400, Rick Dwyer wrote: OK, sorry for any confusion. Here is all my code: $url = http . ((!empty($_SERVER['HTTPS'])) ? s : ) . ://. $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $thepath = parse_url($url); So, given that the URL can vary as follows:

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Robert Cummings
Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable. The problem is, the path can vary

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Adam Richardson
On Sun, Jun 13, 2010 at 9:29 PM, Robert Cummings rob...@interjinn.comwrote: Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the

Re: [PHP] string concatenation with fgets

2009-11-30 Thread Shawn McKenzie
aurfal...@gmail.com wrote: So here is my final test code, notice the check for ' ' in the if. Since I'm on Linux, this has to do with whats between the last LF and EOF which is nothing but this nothing will get printed out. $file = fopen(somefile.txt, r); while (! feof($file)) {

Re: [PHP] string concatenation with fgets

2009-11-30 Thread aurfalien
Hi Shawn, Your code looks cleaner then mine so i tried it and got the last entry in the txt file printed twice. On Nov 30, 2009, at 7:07 AM, Shawn McKenzie wrote: aurfal...@gmail.com wrote: So here is my final test code, notice the check for ' ' in the if. Since I'm on Linux, this has

Re: [PHP] string concatenation with fgets

2009-11-30 Thread Ashley Sheridan
On Mon, 2009-11-30 at 09:04 -0800, aurfal...@gmail.com wrote: Hi Shawn, Your code looks cleaner then mine so i tried it and got the last entry in the txt file printed twice. On Nov 30, 2009, at 7:07 AM, Shawn McKenzie wrote: aurfal...@gmail.com wrote: So here is my final test

Re: [PHP] string concatenation with fgets

2009-11-30 Thread aurfalien
Hi Ash, Actually I need the if because the code will print out an empty line and add sometext to it. So without the if check for an empty line, at the end of the loop I'll get sometext. For example, if the file I am processing called somename.txt has a b c in it. I'll have;

Re: [PHP] string concatenation with fgets

2009-11-30 Thread Ashley Sheridan
On Mon, 2009-11-30 at 09:40 -0800, aurfal...@gmail.com wrote: Hi Ash, Actually I need the if because the code will print out an empty line and add sometext to it. So without the if check for an empty line, at the end of the loop I'll get sometext. For example, if the file I am

Re: [PHP] string concatenation with fgets

2009-11-26 Thread aurfalien
So here is my final test code, notice the check for ' ' in the if. Since I'm on Linux, this has to do with whats between the last LF and EOF which is nothing but this nothing will get printed out. $file = fopen(somefile.txt, r); while (! feof($file)) { $names =

Re: [PHP] string concatenation with fgets

2009-11-24 Thread ryan
Is this what you want $file = fopen(test.txt, r); while (!feof($file)) { $line = trim(fgets($file)); print $line.sometext\n; } fclose($file); outputs asometext bsometext csometext Ref to http://us3.php.net/manual/en/function.fgets.php. Reading ends when /length/ - 1 bytes have been

Re: [PHP] string concatenation with fgets

2009-11-24 Thread Nirmalya Lahiri
--- On Wed, 11/25/09, aurfal...@gmail.com aurfal...@gmail.com wrote: From: aurfal...@gmail.com aurfal...@gmail.com Subject: [PHP] string concatenation with fgets To: php-general@lists.php.net Date: Wednesday, November 25, 2009, 7:00 AM Hi all, I'm trying to append some text to what I read

Re: [PHP] string concatenation with fgets

2009-11-24 Thread aurfalien
On Nov 24, 2009, at 5:55 PM, Nirmalya Lahiri wrote: --- On Wed, 11/25/09, aurfal...@gmail.com aurfal...@gmail.com wrote: From: aurfal...@gmail.com aurfal...@gmail.com Subject: [PHP] string concatenation with fgets To: php-general@lists.php.net Date: Wednesday, November 25, 2009, 7:00 AM Hi

Re: [PHP] string concatenation with fgets

2009-11-24 Thread aurfalien
On Nov 24, 2009, at 5:52 PM, ryan wrote: Is this what you want $file = fopen(test.txt, r); while (!feof($file)) { $line = trim(fgets($file)); print $line.sometext\n; } fclose($file); outputs asometext bsometext csometext Ref to http://us3.php.net/manual/en/function.fgets.php. Reading

[PHP] Re: PHP String convention

2009-11-04 Thread Nathan Rixham
Nick Cooper wrote: Hi, I was just wondering what the difference/advantage of these two methods of writing a string are: 1) $string = foo{$bar}; 2) $string = 'foo'.$bar; 1) breaks PHPUnit when used in classes (need to bug report that) 2) [concatenation] is faster (but you wouldn't notice)

Re: [PHP] Re: PHP String convention

2009-11-04 Thread Lars Torben Wilson
2009/11/4 Nathan Rixham nrix...@gmail.com: Nick Cooper wrote: Hi, I was just wondering what the difference/advantage of these two methods of writing a string are: 1) $string = foo{$bar}; 2) $string = 'foo'.$bar; 1) breaks PHPUnit when used in classes (need to bug report that) 2)

Re: [PHP] String scrambling

2009-09-11 Thread Tom Chubb
!niBgo /* $str = Bingo!; str_shuffle($str); */ :)

Re: [PHP] String scrambling

2009-09-11 Thread Ashley Sheridan
On Fri, 2009-09-11 at 11:03 +0100, Tom Chubb wrote: !niBgo /* $str = Bingo!; str_shuffle($str); */ :) No, that won't work at all, it's in comments ;) Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] String scrambling

2009-09-10 Thread Eddie Drapkin
On Thu, Sep 10, 2009 at 8:57 PM, Ron Piggott ron@actsministries.org wrote: Is there a function in PHP which scrambles strings? Example: $string = Hello; Output might be: ehlol Ron http://www.php.net/manual/en/function.str-shuffle.php -- PHP General Mailing List

Re: [PHP] String to Date Conversion Problem

2009-07-31 Thread Stuart Connolly
Hi Alice, Based on the string format that you mentioned (DD MMM YY - DAY) you should be able to transform to any other date using the following: $parts = explode(' ', '23 JUL 09 - THURSDAY'); echo date('m/d/Y', strtotime({$parts[1]} {$parts[0]} {$parts[2]})); Cheers Stuart On 31 Jul

RE: [PHP] String to Date Conversion Problem

2009-07-31 Thread Alice Wei
Looks like what I did by using mm/dd/ was extra, which was probably why it didn't work. Thanks, looks like this is up and running now. Alice CC: php-general@lists.php.net From: stu...@stuconnolly.com To: aj...@alumni.iu.edu Subject: Re: [PHP] String to Date Conversion Problem Date

Re: [PHP] String variable

2009-01-11 Thread Eric Butera
On Sun, Jan 11, 2009 at 8:59 AM, MikeP mpel...@princeton.edu wrote: Hello, I am trying yo get THIS: where ref_id = '1234' from this. $where=where ref_id=.'$Reference[$x][ref_id]'; but i certainly have a quote problem. Any help? Thanks Mike -- PHP General Mailing List

Re: [PHP] String variable

2009-01-11 Thread Ashley Sheridan
On Sun, 2009-01-11 at 08:59 -0500, MikeP wrote: Hello, I am trying yo get THIS: where ref_id = '1234' from this. $where=where ref_id=.'$Reference[$x][ref_id]'; but i certainly have a quote problem. Any help? Thanks Mike It should look like this: $where=where

Re: [PHP] String variable

2009-01-11 Thread Ashley Sheridan
On Sun, 2009-01-11 at 14:36 +, Ashley Sheridan wrote: On Sun, 2009-01-11 at 08:59 -0500, MikeP wrote: Hello, I am trying yo get THIS: where ref_id = '1234' from this. $where=where ref_id=.'$Reference[$x][ref_id]'; but i certainly have a quote problem. Any help? Thanks

Re: [PHP] String variable

2009-01-11 Thread Nathan Rixham
Ashley Sheridan wrote: On Sun, 2009-01-11 at 14:36 +, Ashley Sheridan wrote: On Sun, 2009-01-11 at 08:59 -0500, MikeP wrote: Hello, I am trying yo get THIS: where ref_id = '1234' from this. $where=where ref_id=.'$Reference[$x][ref_id]'; but i certainly have a quote problem. Any help?

Re: [PHP] String variable

2009-01-11 Thread Lars Torben Wilson
2009/1/11 Ashley Sheridan a...@ashleysheridan.co.uk: On Sun, 2009-01-11 at 14:36 +, Ashley Sheridan wrote: On Sun, 2009-01-11 at 08:59 -0500, MikeP wrote: Hello, I am trying yo get THIS: where ref_id = '1234' from this. $where=where ref_id=.'$Reference[$x][ref_id]'; but i

Re: [PHP] string comparison

2008-07-13 Thread Robert Cummings
On Sun, 2008-07-13 at 21:47 +0530, Sudhakar wrote: hi i am writing a small application where a user enters a phrase in the textfield and i would like to display all the files present in the root directory which consists of the keyword or keywords entered by the user. i have used a few

Re: [PHP] string comparison

2008-07-13 Thread dg
On Jul 13, 2008, at 9:17 AM, Sudhakar wrote: hi i am writing a small application where a user enters a phrase in the textfield and i would like to display all the files present in the root directory which consists of the keyword or keywords entered by the user. i have used a few

Re: [PHP] String to date

2008-06-30 Thread Bastien Koert
On Mon, Jun 30, 2008 at 4:58 PM, Mark Bomgardner [EMAIL PROTECTED] wrote: I need to convert a date retrieved from user input to a mysql date. Here the problem, I need to convert one of three possible combinations, either 01/01/2008,01-01-2008 or 01.01.2008. I can't use explode because it's

Re: [PHP] String to date

2008-06-30 Thread Wolf
Mark Bomgardner [EMAIL PROTECTED] wrote: I need to convert a date retrieved from user input to a mysql date. Here the problem, I need to convert one of three possible combinations, either 01/01/2008,01-01-2008 or 01.01.2008. I can't use explode because it's limited to one character to

RE: [PHP] String to date

2008-06-30 Thread Boyd, Todd M.
-Original Message- From: Mark Bomgardner [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2008 3:58 PM To: php-general@lists.php.net Subject: [PHP] String to date I need to convert a date retrieved from user input to a mysql date. Here the problem, I need to convert one of three

Re: [PHP] String to date

2008-06-30 Thread mike503
couldn't strtotime() do this without any mods? I personally would try that first... On 6/30/08, Mark Bomgardner [EMAIL PROTECTED] wrote: I need to convert a date retrieved from user input to a mysql date. Here the problem, I need to convert one of three possible combinations, either

Re: [PHP] String searching

2008-05-17 Thread Daniel Brown
On Sat, May 17, 2008 at 2:17 AM, Chris W [EMAIL PROTECTED] wrote: I need to find the position of the first character in the string (searching from the end) that is not one of the characters in a set. In this case the set is [0-9a-zA-z-_] To find the position of a specific character, RTFM

Re: [PHP] String searching

2008-05-17 Thread Richard Heyes
Chris W wrote: I need to find the position of the first character in the string (searching from the end) that is not one of the characters in a set. In this case the set is [0-9a-zA-z-_] I guess to be even more specific, I want to split a string into to parts the first part can contain

Re: [PHP] string

2008-04-07 Thread Stut
John Taylor-Johnston wrote: $name = John Taylor; I want to verify if $name contains john, if yes echo found; Cannot remember which to use: http://ca.php.net/manual/en/ref.strings.php Either http://php.net/strpos or http://php.net/stripos if your version of PHP supports it. -Stut --

RE: [PHP] string

2008-04-07 Thread admin
Do a preg match to find one or preg_match_all to find all the john in the string. ?php $name = John Taylor; $pattern = '/^John/'; preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3); print_r($matches); ? $name = John Taylor; I want to verify if $name contains john, if yes

Re: [PHP] string

2008-04-07 Thread Daniel Brown
On Mon, Apr 7, 2008 at 9:25 AM, John Taylor-Johnston [EMAIL PROTECTED] wrote: $name = John Taylor; I want to verify if $name contains john, if yes echo found; Cannot remember which to use: http://ca.php.net/manual/en/ref.strings.php Sorry, John ?php if(stristr($name,'john')) { //

Re: [PHP] string

2008-04-07 Thread John Taylor-Johnston
Excellent. Thanks all! John Daniel Brown wrote: On Mon, Apr 7, 2008 at 9:25 AM, John Taylor-Johnston [EMAIL PROTECTED] wrote: $name = John Taylor; I want to verify if $name contains john, if yes echo found; Cannot remember which to use: http://ca.php.net/manual/en/ref.strings.php Sorry,

Re: [PHP] string

2008-04-07 Thread Mark J. Reed
On Mon, Apr 7, 2008 at 9:30 AM, [EMAIL PROTECTED] wrote: Do a preg match to find one or preg_match_all to find all the john in the string. preg_* is overkill if you're just searching for a literal string. use it if you're searching for any strings matching a pattern, part of which you don't

Re: [PHP] string

2008-04-07 Thread Jim Lucas
Daniel Brown wrote: On Mon, Apr 7, 2008 at 9:25 AM, John Taylor-Johnston [EMAIL PROTECTED] wrote: $name = John Taylor; I want to verify if $name contains john, if yes echo found; Cannot remember which to use: http://ca.php.net/manual/en/ref.strings.php Sorry, John ?php

Re: [PHP] string

2008-04-07 Thread Daniel Brown
On Mon, Apr 7, 2008 at 10:42 AM, Jim Lucas [EMAIL PROTECTED] wrote: I wonder if using strstr() with strtolower() would be faster or slower. [snip=code] Results: Attempt #1 0.015728950500488 0.022881031036377 [snip!] While I don't really care much for a single selection about the

Re: [PHP] string effect

2008-03-04 Thread tedd
At 9:51 PM +0100 2/29/08, Alain Roger wrote: What is the basic rule ? Text is cut off based on (numbers of words, number of characters,..) ? Yes. Use whatever you want. You can use the number characters or find the last *space* in a string that's just long enough to fit your limit. Let's

Re: [PHP] string effect

2008-03-01 Thread Richard Heyes
Mr. Heyes more or less prompted me to go dig for my other, slightly heavier version, that doesn't chop words up: Sorry I hit Reply instead Reply All. Regardless, here's my str_curtail. There is a bug in it that means if the string is all one word then it gets curtailed to nada, but that's

Re: [PHP] string effect

2008-02-29 Thread Greg Donald
On 2/29/08, Alain Roger [EMAIL PROTECTED] wrote: Hi, since a long time now, i see that some paragraphs of text are cut off and the additional text is replaced by 3 dots. e.g: this is the original long text but without any sense and also stupid effect desired : this is the original

Re: [PHP] string effect

2008-02-29 Thread Greg Donald
On 2/29/08, Alain Roger [EMAIL PROTECTED] wrote: Text is cut off based on (numbers of words, number of characters,..) ? what is the algorithm for such thing ? Mr. Heyes more or less prompted me to go dig for my other, slightly heavier version, that doesn't chop words up: function

RE: [PHP] string vs number

2008-02-06 Thread Ford, Mike
On 05 February 2008 21:37, Jochem Maas advised: the same is not exactly true for floats - although you can use them as array keys you'll notice in the output of code below that they are stripped of their decimal part (essentially a floor() seems to be performed on the float value. I have no

Re: [PHP] string vs number

2008-02-06 Thread Jochem Maas
Ford, Mike schreef: On 05 February 2008 21:37, Jochem Maas advised: the same is not exactly true for floats - although you can use them as array keys you'll notice in the output of code below that they are stripped of their decimal part (essentially a floor() seems to be performed on the float

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54']. is this possible? how do i force $rowA[0] to be a string

Re: [PHP] string vs number

2008-02-05 Thread Eric Butera
On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54'].

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:43 PM, Eric Butera [EMAIL PROTECTED] wrote: I was thinking about saying that, but php is loosely typed, so 54 == '54'. i only mentioned the type cast because it was asked about; actually, there are rare times in php when type casts are called for, such as pulling a value from

Re: [PHP] string vs number

2008-02-05 Thread Casey
On Feb 5, 2008, at 10:43 AM, Eric Butera [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got

Re: [PHP] string vs number

2008-02-05 Thread Nathan Nobbe
On Feb 5, 2008 1:50 PM, Casey [EMAIL PROTECTED] wrote: I believe this is the difference with arrays: $a = array(2 = foo); Array(0 = null, 1 = null, 2 = foo) $a = array(2 = foo); Array(2 = foo) i think the implicit type casting applies there as well: php $meh = array(2=4); php echo

Re: [PHP] string vs number

2008-02-05 Thread Eric Butera
On Feb 5, 2008 1:48 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:43 PM, Eric Butera [EMAIL PROTECTED] wrote: I was thinking about saying that, but php is loosely typed, so 54 == '54'. i only mentioned the type cast because it was asked about; actually, there are rare times

Re: [PHP] string vs number

2008-02-05 Thread Daniel Brown
On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ? debugging, i got $rowA[0] = 54, but i want $rowB[$rowA[0]] = $rowB['54']. is this possible? how do i force $rowA[0] to be a string ('54')?

Re: [PHP] string vs number

2008-02-05 Thread Jochem Maas
Casey schreef: On Feb 5, 2008, at 10:43 AM, Eric Butera [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 5, 2008 1:36 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi all, i have this php statement: ? if($rowB[$rowA[0]]=='Y') {echo checked;} ?

Re: [PHP] String Issue

2008-01-23 Thread Robert Cummings
On Wed, 2008-01-23 at 23:30 -0600, Johny Burns wrote: I have the following string on the address line HTMLFiles/MenuDisplay.php?var=Thai%20ImageItem=1797Action=add I am trying to delete or replace the 'Item=1797Action=add' (it is at the end of the string) I am not familiar as much

Re: [PHP] String Issue

2008-01-23 Thread venkatk
Hi, Try this: $str = 'HTMLFiles/MenuDisplay.php?var=Thai%20ImageItem=1797Action=add'; $str = preg_replace(/(\Item.*)$/,REPLACEMENT STRING, $str); this should work. Cheers, V -Original Message- From: Johny Burns [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thu, 24

Re: [PHP] string as file

2007-08-10 Thread Stut
Robert Cummings wrote: On Fri, 2007-08-10 at 16:28 +0100, Stut wrote: Rick Pasotto wrote: On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote: Rick Pasotto wrote: On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a

Re: [PHP] string as file

2007-08-10 Thread Robert Cummings
On Fri, 2007-08-10 at 16:28 +0100, Stut wrote: Rick Pasotto wrote: On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote: Rick Pasotto wrote: On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to

Re: [PHP] string as file

2007-08-10 Thread Jim Lucas
Rick Pasotto wrote: On Thu, Aug 09, 2007 at 02:39:51PM -0700, Jim Lucas wrote: Rick Pasotto wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out = EOT This is an example of $var1 and

Re: [PHP] string as file

2007-08-10 Thread Stut
Rick Pasotto wrote: On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote: Rick Pasotto wrote: On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is

Re: [PHP] string as file

2007-08-10 Thread Rick Pasotto
On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote: Rick Pasotto wrote: On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge.

Re: [PHP] string as file

2007-08-10 Thread Rick Pasotto
On Thu, Aug 09, 2007 at 02:39:51PM -0700, Jim Lucas wrote: Rick Pasotto wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out = EOT This is an example of $var1 and $var2. EOT; and

Re: [PHP] string as file

2007-08-10 Thread Rick Pasotto
On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out = EOT This is

Re: [PHP] string as file

2007-08-10 Thread Stut
Rick Pasotto wrote: On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote: On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out =

Re: [PHP] string as file

2007-08-09 Thread Greg Donald
On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out = EOT This is an example of $var1 and $var2. EOT; and then after assigning values

Re: [PHP] string as file

2007-08-09 Thread Jim Lucas
Rick Pasotto wrote: Does php have a facility similar to python's stringIO? What I'm wanting to do is similar to a mail merge. IOW, I know I can create an include file like: $out = EOT This is an example of $var1 and $var2. EOT; and then after assigning values to $var1 and $var2 include that

RE: [PHP] string problem

2006-07-10 Thread Jay Blanchard
[snip] I have the SQL statement which store in $str variable as shown below : How to get the '%WS-X5225R%' from $str variable ? $str = SELECT DISTINCT(tbl_chassis.serial_no),tbl_card.card_model, ; tbl_chassis.host_name,tbl_chassis.chasis_model,tbl_chassis.country,;

Re: [PHP] STRING TO ASCII CHARACTERS

2006-06-24 Thread John Hicks
Ahmed Saad wrote: 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 And, for the record, you are not converting a string to ASCII, rather an ASCII string to its decimal

  1   2   3   4   5   >