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
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 =
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
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
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
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
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
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
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
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?
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
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?
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
-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.
* 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,
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
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
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;
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
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);
[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
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
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
--- 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
--- 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
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
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
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
[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
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
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
[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
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
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
* 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
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
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
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
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
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);
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
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
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
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
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
$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
* 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
$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, );
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
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]
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 = '';
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
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:
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,
- 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
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
, 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
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.
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:
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';
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
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
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
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
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
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
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/)
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/)
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
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
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
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
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 =
:[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
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
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?
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
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?
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
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
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
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
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.
--
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]
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
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
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
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
- 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
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
- 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
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
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)
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
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
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
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,
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
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 =
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
201 - 300 of 407 matches
Mail list logo