RE: [PHP] String compare of 7 text strings

2004-08-13 Thread Ed Lazor
Nice solution =) -Original Message- sort ( $array ); if ( $array[ 0 ] !== $array[ count ( $array )-1 ] ) { // Not all fields in the array are the same... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] string manipulation

2004-08-12 Thread Michal Migurski
Hi I am trying to track down a method for transferring a database id such as 5 into a nice formatted order id such as ORD0005 - where the format for the order id is ORD + 5 digits made up of the database id See documentation for sprintf(). Try something like: $formatted =

Re: [PHP] string manipulation

2004-08-12 Thread Jason Wong
On Friday 13 August 2004 01:00, Matthew Oatham wrote: Hi I am trying to track down a method for transferring a database id such as 5 into a nice formatted order id such as ORD0005 - where the format for the order id is ORD + 5 digits made up of the database id str_pad(), please RTFM before you

Re: [PHP] string manipulation

2004-08-12 Thread John Nichel
Jason Wong wrote: str_pad(), please RTFM before you ask such questions. It's obvious from your subject that you know it's something to do with strings, so where better than to look at the chapter on String Functions? Browse through them, checkout the examples, it's a good way to learn. But I

Re: [PHP] String formatting

2004-08-06 Thread Jason Davidson
you could remove all br tags, \n \r chars from the string. use $string = str_replace(array('\r','\n','br'), '', $string); or something similar Jason Jed R. Brubaker [EMAIL PROTECTED] wrote: Hey all! Glad you are here. I have a question that is confusing me a bit. I am trying to output a

Re: [PHP] String formatting

2004-08-06 Thread raditha dissanayake
Jed R. Brubaker wrote: Hey all! Glad you are here. I have a question that is confusing me a bit. I am trying to output a string that is pulled from a database that I don't have control over. Everything is great, except that the string needs to be all on one line with no line breaks (for

Re: [PHP] String formatting

2004-08-06 Thread Robert Cummings
On Fri, 2004-08-06 at 13:24, Jed R. Brubaker wrote: Hey all! Glad you are here. I have a question that is confusing me a bit. I am trying to output a string that is pulled from a database that I don't have control over. Everything is great, except that the string needs to be all on one

Re: [PHP] String formatting

2004-08-06 Thread Jason Davidson
you could use css too now that i think of it.. wrap your stirng in some div tag or somehting and use white-space: nowrap; or something like that. Jason [EMAIL PROTECTED] wrote: Jed R. Brubaker wrote: Hey all! Glad you are here. I have a question that is confusing me a bit. I am trying

Re: [PHP] string filtering

2004-07-20 Thread John W. Holmes
C.F. Scheidecker Antunes wrote: I need to filter some strings. They can only contain characters like a...z or A..Z and 0..9. Some strings have blank spaces, -,./?, characters that must be discarded. I wrote a function to check each and every character but I guess there must be something else

Re: [PHP] string function that adds before and after

2004-06-25 Thread Matt M.
There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for?

Re: [PHP] string function that adds before and after

2004-06-25 Thread Gabe
Matt M. wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm

Re: [PHP] string function that adds before and after

2004-06-25 Thread Philip Olson
There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for?

Re: [PHP] string function that adds before and after

2004-06-25 Thread Gabe
Philip Olson wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm

Re: [PHP] string function that adds before and after

2004-06-25 Thread Richard Harb
-Original Message- From: Gabe Sent: Friday, June 25, 2004, 9:06:15 PM Philip Olson wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match.

Re: [PHP] string function that adds before and after

2004-06-25 Thread Curt Zirzow
* Thus wrote Richard Harb: -Original Message- From: Gabe Sent: Friday, June 25, 2004, 9:06:15 PM Philip Olson wrote: lots of ... I'd say it will do the job just fine if case sensitivity is not an issue: $word = 'weather'; $new = str_replace($word, strong$word/strong,

Re: [PHP] String Question

2004-05-02 Thread John W. Holmes
Dave Carrera wrote: How would I show 100 chars after finding the first instance of a searched word in a string. $start = strpos('hello',$str); $hundredchars = substr($str,$start,100); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for

Re: [PHP] string replace in files

2004-04-30 Thread John W. Holmes
From: Steve Buehler [EMAIL PROTECTED] I am trying to write a script that will replace a string in a file. Actually, about 3000 files. And I am stuck. I can get the list of files, but then I pretty much become stuck. I wanted to try str_ireplace (not sure if that is what I should use or

Re: [PHP] string replace in files

2004-04-30 Thread Steve Buehler
At 11:27 AM 4/30/2004, John W. Holmes wrote: From: Steve Buehler [EMAIL PROTECTED] #!/usr/bin/php ? $strtoreplace=require \http://www.domain.com/;; $replacewithstring=require \/home/domain/www/; replacestring(); function replacestring(){ GLOBAL $strtoreplace,$replacewithstring;

Re: [PHP] string replace in files

2004-04-30 Thread John W. Holmes
From: Steve Buehler [EMAIL PROTECTED] Thank you so much for this. I was thinking of it all wrong when doing this. I have a couple of other questions to go along with this. 1. How would I change this to do a recursive search for the .php files instead of just the *.php or */*.php

Re: [PHP] String replace in php

2004-04-22 Thread Jason Wong
On Friday 23 April 2004 12:30, T UmaShankari wrote: I need to replace a character with \. Using php how to do this. i have given like this but it is giving parse error $temps=str_replace('','\',$temp); Can anyone tell me how to do this ? Try: $temps = str_replace('','\\',$temp);

RE: [PHP] string to float

2004-03-23 Thread Jay Blanchard
[snip] How do I change a string to a float, when the string may be in this format : 4,999.90 , or this format: 4999,90 (european style) [/snip] http://us4.php.net/settype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] string concatination

2004-03-23 Thread Chris W. Parker
Matthew Oatham mailto:[EMAIL PROTECTED] on Tuesday, March 23, 2004 3:59 PM said: Hi, hi. What is the correct way, using php to join to strings, vars or other wise. [snip] i.e. how do I join $string1 = hello; $string2 = world; do i do $string1 . $string2; [snip] Is that

Re: [PHP] String Length ??

2004-03-22 Thread Filip de Waard
On Mar 22, 2004, at 1:46 PM, gordon stewart wrote: === foreach ($text as $color) { echo SAF '$color' - ; echo B.strlen($color)./BBR\n; } === QUESTION :- Is this the right code to use ? to find the length of each line ? ($color) - No worries - Ive just copied code from the web

Re: [PHP] String Length ??

2004-03-22 Thread gordon stewart
--- Filip de Waard [EMAIL PROTECTED] wrote: strlen() is the correct function to use here. Use it like: echo strlen($_POST['input_name']); Thanks... Where $_POST['input_name'] should be replaced by the variable you want to check. strlen() is always right, but it counts the actual

[PHP] Thanks : Re: [PHP] String Length ??

2004-03-22 Thread gordon stewart
--- Filip de Waard [EMAIL PROTECTED] wrote: strlen() is the correct function to use here. Use it like: echo strlen($_POST['input_name']); Where $_POST['input_name'] should be replaced by the variable you want to check. strlen() is always right, but it counts the actual charactars of

Re: [PHP] String replacement problems...

2003-12-23 Thread CPT John W. Holmes
From: John Clegg [EMAIL PROTECTED] I am trying to figure out how to get ereg_replace / preg_replace to replace a match only once. The fourth parameter to preg_replace() is an integer limit to how many matches you want to allow. So, if you only want 1 replacement to occur, pass 1. :) ---John

Re: [PHP] String construction help required please

2003-12-01 Thread Robert Cummings
On Mon, 2003-12-01 at 01:59, Dave Carrera wrote: Hi List, I need to construct a string to visually show to the user some $_POST vars. I need to display : $_POST[$var], Including the and the , . I have tried : \\$_POST[\.$var.\], but that is very wrong. Could one of you kind list

Re: [PHP] String construction help required please

2003-12-01 Thread Justin French
On Monday, December 1, 2003, at 05:59 PM, Dave Carrera wrote: I need to construct a string to visually show to the user some $_POST vars. I need to display : $_POST[$var], Including the and the , . I have tried : \\$_POST[\.$var.\], but that is very wrong. Could one of you kind list

RE: [PHP] String construction help required please

2003-12-01 Thread Jay Blanchard
[snip] I need to display : $_POST[$var], Including the and the , . I have tried : \\$_POST[\.$var.\], but that is very wrong. Could one of you kind list members show me what it should be please ? You have a couple of options... just pick the one that suits you... ? echo

RE: [PHP] String construction help required please

2003-12-01 Thread Wouter van Vliet
Jay Blanchard wrote: [snip] I need to display : $_POST[$var], Including the and the , . I have tried : \\$_POST[\.$var.\], but that is very wrong. Could one of you kind list members show me what it should be please ? You have a couple of options... just pick the one that suits

Re: [PHP] string

2003-12-01 Thread Matt Matijevich
snip Name|17|5|7|12|26|8|4|0|2|0|40|12.50|3|33.30|19 it should 16 pieces. Any thoughts on how I can get it to cut off at the 19, one thing that I should say is 19 is value that can change. /snip Can't you just use the explode function? http://www.php.net/manual/en/function.explode.php -- PHP

RE: [PHP] String display issue

2003-11-24 Thread Jay Blanchard
[snip] I am writing an application where users will input information such as 6' section of 3/4 pipe How can I get the whole line to show up on the screen when both single and double quotes are contained in the text string. [/snip] addslashes going in stripslashes coming out

Re: [PHP] String display issue

2003-11-24 Thread John W. Holmes
Jay Blanchard wrote: [snip] I am writing an application where users will input information such as 6' section of 3/4 pipe How can I get the whole line to show up on the screen when both single and double quotes are contained in the text string. [/snip] addslashes going in stripslashes coming out

Re: [PHP] String returned from forms and such

2003-11-23 Thread David Otton
On Sun, 23 Nov 2003 15:19:23 -0700, you wrote: When the 'New Mexico' gets to phpinfo, it says the string is 'New+Mexico' and that's not what I need. I used htmlspecialchars to add the %20 to the string but didn't get it. What am I doing wrong or missing?? That sounds like the behaviour of

Re: [PHP] String matching for sample code doesn't work....

2003-11-19 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): Hi Everyone! --snip-- $res_str = Dog NameWhoof/Dog Name![CDATA[Whose Dog is that??]]; for ($i=0;$i100;$i++) { if (substr($res_str, $i, 9) == ![CDATA[) um.. lookup this function: http://www.php.net/strpos Curt -- My

Re: [PHP] String Array Creation and assigment

2003-11-03 Thread Dan
i found the problem myself, array has to be defined like this: $b=array[0=0]; then $b can be any array of any type of index and values as you wish to assign to it. Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] please help with the following: I tried this first : $b[] = 'Book

Re: [PHP] String Array Creation and assigment

2003-10-30 Thread Eugene Lee
On Wed, Oct 29, 2003 at 12:47:58PM -0500, Dan wrote: : : please help with the following: : : I tried this first : : $b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur: how to : turn your experience into a fortune. Toronto: Key Porter books.'; : $b[] = 'Book Ries, Al and Jack

Re: [PHP] String Array Creation and assigment

2003-10-29 Thread Dan
please help with the following: I tried this first : $b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur: how to turn your experience into a fortune. Toronto: Key Porter books.'; $b[] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of Marketing. New York: Harper

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread David T-G
Zheng -- ...and then sun zheng said... % % Hi, all, Hi! % ... % I explode it first by . % $execoutput = % approved=yeserror=authnumber=025968transactionnumber=313869; % $execoutput_array = explode(, $execoutput); I don't see any problem with this. % % I secondly explode every

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread sun zheng
tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. approved=yeserror=authnumber=025968transactionnumber=313869; after the statement for (@reset($value_array);

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread Duncan
sun zheng said: tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. approved=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread sun zheng
tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. approved=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something like

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread Duncan Hill
sun zheng said: tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. approved=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something like

RE: [PHP] String substiion for flash text

2003-08-29 Thread Chris W. Parker
Luis Lebron mailto:[EMAIL PROTECTED] on Friday, August 29, 2003 12:41 PM said: Is there a way I can change something like a href=mylink.htmlMy Link/a to a href=mylink.htmlulMy Link/ul/a Yes. Probably best to use regular expressions. Read up on www.php.net/preg_replace as a starting

Re: [PHP] String parsing help

2003-08-21 Thread Jonatan Pugliese.
it's true my example is bad I no evaluate the last line sorry !!! - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Jonatan Pugliese. [EMAIL PROTECTED]; Matt Matijevich [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 5:44 PM Subject: Re: [PHP

Re: [PHP] String parsing help

2003-08-20 Thread Jonatan Pugliese.
$vector=split( , $string, ); $City=$vector[0]; $State=$vector[1]; $Zip=$vector[2]: - Original Message - From: Matt Matijevich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 5:11 PM Subject: [PHP] String parsing help I have have a string that I need to

Re: [PHP] String parsing help

2003-08-20 Thread Curt Zirzow
* Thus wrote Matt Matijevich ([EMAIL PROTECTED]): I have have a string that I need to split into 3 different variables: City,State, and Zip. Here is a couple examples of the strings I need to parse: ANCHORAGE AK 99507-6420 JUNEAU AK 99801 NORTH LITTLE ROCK AR 72118-5227 Does

Re: [PHP] String parsing help

2003-08-20 Thread Rafael Zanetti
$vector=split( , $string, ); $City=$vector[0]; $State=$vector[1]; $Zip=$vector[2]: This will not work because there cases where the city name have more than 1 word you must get from end-to-begining i can't think about it now, but it's a tip anyway $vector=split( , $string, );

Re: [PHP] String parsing help

2003-08-20 Thread CPT John W. Holmes
From: Jonatan Pugliese. [EMAIL PROTECTED] From: Matt Matijevich [EMAIL PROTECTED] I have have a string that I need to split into 3 different variables: City,State, and Zip. Here is a couple examples of the strings I need to parse: ANCHORAGE AK 99507-6420 JUNEAU AK 99801 NORTH

Re: [PHP] String parsing help

2003-08-20 Thread Steve Edberg
Or (untested): $String = 'NORTH LITTLE ROCK AR 72118-5227'; $Bits = split(strrev($String), '[[:space:]]+', 3); $Zip = strrev($Bits[0]); $State = strrev($Bits[1]); $City = strrev($Bits[2]); ...could also use preg_split() - steve At 4:44 PM -0400 8/20/03, CPT John W. Holmes [EMAIL PROTECTED]

Re: [PHP] string concatenation from array

2003-08-14 Thread Analysis Solutions
On Tue, Aug 12, 2003 at 01:58:21PM -0600, Micah Montoy wrote: I'm having a bit of difficulty getting a string to attach to itself from an array. Here is the bit of code I'm working on. A bunch of simplifications, efficiency tweaks on this approach... $wresult = ; $wresult = '';

Re: [PHP] string concatenation from array

2003-08-14 Thread Jonathan Pitcher
Micah, The sign in PHP (to the best of my knowledge) does not concatenate. Use a . instead. See below. $wresult = ; foreach ($search_string as $word_result){ $wresult .= $word_result; } That should work for you. Jonathan Pitcher On Tuesday, August 12, 2003, at 02:58 PM, Micah

RE: [PHP] string concatenation from array

2003-08-14 Thread Chris W. Parker
Analysis Solutions mailto:[EMAIL PROTECTED] on Tuesday, August 12, 2003 1:02 PM said: OR you can do... $wresult .= $word_result; Don't forget the space: $wresult .= .$word_result; c. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] string concatenation from array

2003-08-14 Thread CPT John W. Holmes
From: Jonathan Pitcher [EMAIL PROTECTED] The sign in PHP (to the best of my knowledge) does not concatenate. Correct, it's a bitwise AND operator. http://us2.php.net/manual/en/language.operators.bitwise.php ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] string concatenation from array

2003-08-14 Thread Peter James
- Original Message - From: Peter James [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 2:18 PM Subject: Re: [PHP] string concatenation from array My personal favourite is to use an array. It's much cleaner syntax IMO...it is very easy to miss a '.' on a '.=', and introduce

RE: [PHP] string concatenation from array

2003-08-14 Thread Matt Giddings
Use the . concatenation operator. : ) $wresult = ; foreach ($search_string as $word_result) { $wresult = $wresult . . $word_result; } echo $wresult; Matt -Original Message- From: Micah Montoy [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 3:58 PM To: [EMAIL

Re: [PHP] string concatenation from array

2003-08-14 Thread Peter James
, 2003 2:00 PM Subject: RE: [PHP] string concatenation from array Use the . concatenation operator. : ) $wresult = ; foreach ($search_string as $word_result) { $wresult = $wresult . . $word_result; } echo $wresult; Matt -Original Message- From: Micah Montoy [mailto

Re: [PHP] STRING FORMATTING QUESTION

2003-07-17 Thread Curt Zirzow
Dale Hersh [EMAIL PROTECTED] wrote: My question is regarding strings in php. I have this form in which the user fills in a description. The problem is that if the user uses any aprostrophe's or any other unusual characters in the form, the string can not be inserted into my ms sql database.

Re: [PHP] String conversion function

2003-07-09 Thread Pascal Polleunus
Simon Fredriksson wrote: I'm wondering if there's any easy way to convert special chars to the numerical version of it. Like space converts to %20 and slash (/) to %2F. rawurlencode is what you're looking for -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] string modification

2003-07-03 Thread Leif K-Brooks
hi, i didn't find a function for this in the manual, but maybe there is one (or a workaround): does anyone have a solution for replacing multiple whitespaces with a single whitespace whitin a string? similar to trim(). maybe a regular expression? eg: $string = 'word1 word2 word3';

Re: [PHP] string modification

2003-07-03 Thread sven
thanks, this works. ciao SVEN Leif K-Brooks wrote: hi, i didn't find a function for this in the manual, but maybe there is one (or a workaround): does anyone have a solution for replacing multiple whitespaces with a single whitespace whitin a string? similar to trim(). maybe a regular

RE: [PHP] String containing PHP Code

2003-06-16 Thread Martin Towell
you can use exec() but be sure that the code you're executing is not malicious first -Original Message- From: Suhas Pharkute [mailto:[EMAIL PROTECTED] Sent: Tuesday, 17 June 2003 9:46 AM To: [EMAIL PROTECTED] Subject: [PHP] String containing PHP Code Hello, I have a php script

Re: [PHP] String containing PHP Code

2003-06-16 Thread Steve Keller
At 6/16/2003 05:45 PM, Suhas Pharkute wrote: I have a php script which generates a string which has php code in it. I need to run that code. http://www.php.net/eval -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK

RE: [PHP] String containing PHP Code

2003-06-16 Thread Martin Towell
oops - yeah, not exec() as in my previous email - sorry about that :/ -Original Message- From: Steve Keller [mailto:[EMAIL PROTECTED] Sent: Tuesday, 17 June 2003 10:06 AM To: Suhas Pharkute; [EMAIL PROTECTED] Subject: Re: [PHP] String containing PHP Code At 6/16/2003 05:45 PM, Suhas

Re: [PHP] String containing PHP Code

2003-06-16 Thread Lars Torben Wilson
On Mon, 2003-06-16 at 16:45, Suhas Pharkute wrote: Hello, I have a php script which generates a string which has php code in it. I need to run that code. For example: ?php $str = ?php echo 'Hello World!'; ?; ? Is there any way that we can do it? I know I can do it by

RE: [PHP] string question

2003-06-11 Thread John W. Holmes
if a string is: $x=A.B. XYZ; and if I post it as a hidden form control and echo $_POST['x'] then I get: A.B. and not A.B. XYZ ! What should I do? Learn HTML. Use quotes around your attribute values: input type=hidden name=foo value=A.B. XYZ ---John W. Holmes... Amazon

Re: [PHP] string question

2003-06-11 Thread Chris Hayes
At 16:42 11-6-03, you wrote: if a string is: $x=A.B. XYZ; and if I post it as a hidden form control and echo $_POST['x'] then I get: A.B. and not A.B. XYZ ! What should I do? how do you assign the value to the hidden form element? -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] string question

2003-06-11 Thread Brian V Bonini
On Wed, 2003-06-11 at 10:42, Mukta Telang wrote: Hi, if a string is: $x=A.B. XYZ; and if I post it as a hidden form control and echo $_POST['x'] then I get: A.B. and not A.B. XYZ ! What should I do? Mukta $x = 'A.B. XYZ'; -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] string question

2003-06-11 Thread Leif K-Brooks
Put quotes around the value attribute of your input tag, for example input type=hidden name=x value=A.B. XYZ / Mukta Telang wrote: Hi, if a string is: $x=A.B. XYZ; and if I post it as a hidden form control and echo $_POST['x'] then I get: A.B. and not A.B. XYZ ! What should I

Re: [PHP] String manipulation

2003-06-11 Thread Jake Johnson
Use the substr function to get the part you want. Then prefix/suffix the parts you want. //you may want to derive the positions as vars $rest = substr(abcdef, 1, 3); // returns bcd //you may want to put the link name into a var as well for below $rest = a href=\ . $rest . the link/a Good

Re: [PHP] String manipulation

2003-06-11 Thread Wendell Brown
On Wed, 11 Jun 2003 14:53:13 +0100, Marios Adamantopoulos wrote: [link][title]the link[/title][address]http://www.php.net[/address][/link] And I need to change it to this: a href=http://www.php.net;the link/a E, fun try this :) ?PHP $in = '[link][title]the

RE: [PHP] String Manipulation

2003-06-02 Thread Don Read
On 31-May-2003 S. Cole wrote: Hello all, I'm currently working on a site for my brother-in-law. I have written a script that will access a website (http://www.remax.nf.ca/listings.asp?a=163cp=1) and pull the page into a variable ($var). I have striped the page down to include only the

RE: [PHP] string replace problem!!

2003-03-28 Thread Rich Gray
Good day , I have the following string. ,slideimages[0],slideimages[1],slideimages[2] Wich starts with a ','. No my problem is i want to strip this first and only the first ','. i've tried $string = ,slideimages[0],slideimages[1],slideimages[2]; $string =

RE: [PHP] string replace problem!!

2003-03-28 Thread Thijs Lensselink
:[EMAIL PROTECTED] Verzonden: vrijdag 28 maart 2003 12:39 Aan: Thijs Lensselink; [EMAIL PROTECTED] Onderwerp: RE: [PHP] string replace problem!! Good day , I have the following string. ,slideimages[0],slideimages[1],slideimages[2] Wich starts with a ','. No my problem is i want to strip

RE: [PHP] String Replace

2003-03-14 Thread Niklas Lampén
There is many functions that can do it. str_replace() is the fastest on thisone. preg_match() comes on second position, and after that comes ereg_replace(). But if you need to do harder replacing, preg_match() is the one to use, imo. Niklas -Original Message- From: Awlad Hussain

Re: [PHP] String Replace

2003-03-14 Thread Leif K-Brooks
www.php.net/str-replace Awlad Hussain wrote: I have a string with underscore in the middle.. like This_That which function do i use to replace the _ with space? eg to This That the string is in a variable.. I know its really simple but just don't know which function to use. any suggestion?

RE: [PHP] string validating

2003-03-12 Thread John W. Holmes
im reading in a string from a database, this string will become a file name. so i need to strip everything BUT lowercase a-z and 0-9. well im strtolower so i dont need to worry about upper case. blank spaces get replaced with _ $filename = preg_replace(/[^a-z0-9]/,_,$data); Replace _ with

Re: [PHP] String searching peformance

2003-02-26 Thread {R}ichard Ashton
On Mon, 24 Feb 2003 22:35:35 +0100, Ernest E Vogelsinger wrote: At 21:22 24.02.2003, {R}ichard Ashton spoke out and said: [snip] while ( $flag == true ) if (strpos($body, $word[]) 0) {$flag=false} What I really need to know is which is the fastest loop?

Re: [PHP] String searching peformance

2003-02-26 Thread Ernest E Vogelsinger
At 09:49 26.02.2003, {R}ichard Ashton said: [snip] Do you think that: if (preg_match($re, $posting, $hits)) would slow it down at all. The $buzzwords will be kept in a file to be loaded before each run, every 5 minutes. I could therefore keep a count of

Re: [PHP] String searching peformance

2003-02-26 Thread Jason Wong
On Wednesday 26 February 2003 16:49, {R}ichard Ashton wrote: Do you think that: if (preg_match($re, $posting, $hits)) would slow it down at all. The $buzzwords will be kept in a file to be loaded before each run, every 5 minutes. I could therefore keep a count of which words hit most

Re: [PHP] String searching peformance

2003-02-26 Thread {R}ichard Ashton
On Wed, 26 Feb 2003 17:47:41 +0800, Jason Wong wrote: On Wednesday 26 February 2003 16:49, {R}ichard Ashton wrote: Do you think that: if (preg_match($re, $posting, $hits)) would slow it down at all. The $buzzwords will be kept in a file to be loaded before each run, every 5 minutes. I could

Re: [PHP] String searching peformance

2003-02-24 Thread Ernest E Vogelsinger
At 21:22 24.02.2003, {R}ichard Ashton spoke out and said: [snip] while ( $flag == true ) if (strpos($body, $word[]) 0) {$flag=false} What I really need to know is which is the fastest loop? Which is the fastest match, strpos? Which is the fastest

Re: [PHP] string manipulation

2003-02-20 Thread Leif K-Brooks
Try this (untested): print preg_replace('|[^]*$|','$1',$text); Gregory Heinrichs wrote: little help please, looking for correct functions to use to search for the last occurrence of a character in a string and truncate everything in front of it including the searched for character. --

RE: [PHP] string manipulation

2003-02-20 Thread Kelly Protsko
Use strrpos() which will find the last occurrence of something in a string then just use substr() to pull everything from that point on in the string. Kelly -Original Message- From: Gregory Heinrichs [mailto:[EMAIL PROTECTED]] Sent: February 20, 2003 5:13 PM To: [EMAIL PROTECTED]

Re: [PHP] string manipulation

2003-02-20 Thread Joachim Krebs
This is the best method echo substr(strrchr($string, $char), 1); On 21 February 2003 at 00:13:02, Gregory Heinrichs wrote: little help please, looking for correct functions to use to search for the last occurrence of a character in a string and truncate everything in front of it

Re: [PHP] string to array

2003-02-12 Thread Leif K-Brooks
There's no built-in function, but try this (copied from manual): $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); Kevin Waterson wrote: What is the best method to convert a string to an array I need to able to loop through each letter of the string not just use $string[47] Is there

Re: [PHP] string to array

2003-02-12 Thread Steve Werby
Kevin Waterson [EMAIL PROTECTED] wrote: What is the best method to convert a string to an array I need to able to loop through each letter of the string not just use $string[47] You can find out how long it is using strlen(), then loop through it using your favorite looping construct. You

Re: [PHP] string prints out as number (E+10...), why?

2003-01-09 Thread - Edwin
Hello, Jean-Christian Imbeault [EMAIL PROTECTED] wrote: I'm passing a var into a function which is a 16 digit number, but when I try to print it out I get 1.111E+15 instead of the expected 11. Why? I guess it's because the number is converted automatically to an

Re: [PHP] string prints out as number (E+10...), why?

2003-01-09 Thread Jean-Christian Imbeault
- Edwin wrote: I guess it's because the number is converted automatically to an exponential notation if it goes over a certain number of digits--makes it easier to read... I figured as much. But why? I found a solution by changing the precision of floats in the php.ini file. But I still find

Re: [PHP] string prints out as number (E+10...), why?

2003-01-09 Thread - Edwin
Jean-Christian Imbeault [EMAIL PROTECTED] wrote: - Edwin wrote: I guess it's because the number is converted automatically to an exponential notation if it goes over a certain number of digits--makes it easier to read... I figured as much. But why? I found a solution by changing

Re: [PHP] string prints out as number (E+10...), why?

2003-01-09 Thread Jean-Christian Imbeault
- Edwin wrote: [...] As you can see, PHP didn't touch the string version... True. My var is being passed in as a POST var so maybe that has something to do with it ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] String to an Array

2002-12-07 Thread Justin French
I *think* either: ? $str = im the one trying to do this; echo $str[0]; ? OR ? $str = im the one trying to do this; echo $str{0}; ? Works -- you'll have to experiment, but I believe the second way is correct, and will echo the first (0th) character in the string. If you want to get more than

Re: [PHP] String to an Array

2002-12-07 Thread Rick Widmer
At 11:15 AM 12/8/02 +1100, Justin French wrote: I *think* either: ? $str = im the one trying to do this; echo $str[0]; ? OR ? $str = im the one trying to do this; echo $str{0}; ? Works -- you'll have to experiment, but I believe the second way is correct, and will echo the first (0th)

Re: [PHP] String to an Array

2002-12-06 Thread Matt Vos
A string is an array of characters. In your example, $str[4] == h. Matt - Original Message - From: Rodrigo de Oliveira Costa [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 05, 2002 1:50 PM Subject: [PHP] String to an Array Hi guys, I got a string that I need to be

Re: [PHP] String to an Array

2002-12-06 Thread @ Edwin
Hello, Rodrigo de Oliveira Costa [EMAIL PROTECTED] wrote: Hi guys, I got a string that I need to be transformed into na array of characters, something like: $str =im the one trying to do this; //this is the string I'd like to get an array that I can access something like

Re: [PHP] String to an Array

2002-12-06 Thread Jason Wong
On Saturday 07 December 2002 02:12, [EMAIL PROTECTED] wrote: Hello, Rodrigo de Oliveira Costa [EMAIL PROTECTED] wrote: Hi guys, I got a string that I need to be transformed into na array of characters, something like: $str =im the one trying to do this; //this is the string

Re: [PHP] String function

2002-11-28 Thread Marco Tabini
You can use strstr: if (strstr ($str, '.')) echo 'Full stop'; else echo 'No full stop'; Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmers On Thu, 2002-11-28 at 08:49, Shaun wrote: Hi,

Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
Quick and Dirty: ?php $string = 'hello how are you today'; $new_string = preg_split(/[\s]?/, $string); print_r($new_string); ? Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] If you need PHP hosting with an experienced support team 24/7 then email me today. On Fri, 8 Nov 2002, Marek

Re: [PHP] string to array

2002-11-08 Thread Tom Rogers
Hi, Friday, November 8, 2002, 10:43:10 PM, you wrote: MK Hi all, MK has anyone an elegant (and faster) way of converting 'string' to MK array('s','t','r','i','n','g'), other then MK for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i]; A string is already an array of chars $string =

Re: [PHP] string to array

2002-11-08 Thread Erwin
Tom Rogers wrote: Hi, Friday, November 8, 2002, 10:43:10 PM, you wrote: Hi all, has anyone an elegant (and faster) way of converting 'string' to array('s','t','r','i','n','g'), other then for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i]; A string is already an array of chars

<    1   2   3   4   5   >