function stransform($string) {
for ($i=0;$ilength($string);$i++) {
$data .= #.ord(substr($string,$i,1)).;;
}
return $data;
}
Juanjo Pascual wrote:
Do you know any way to convert any string to ascii characters??
I mean:
*abcdefgh*
to
Ok. Thanks.
You only have to change the function *length() *by the function *strlen()*
cajbecu escribió:
function stransform($string) {
for ($i=0;$ilength($string);$i++) {
$data .= #.ord(substr($string,$i,1)).;;
}
return $data;
}
Juanjo Pascual wrote:
Do you know
That`s true, my mistake.. (length is in pascal)
cheers,
Juanjo Pascual wrote:
Ok. Thanks.
You only have to change the function *length() *by the function *strlen()*
cajbecu escribió:
function stransform($string) {
for ($i=0;$ilength($string);$i++) {
$data .=
On 23/06/06, cajbecu [EMAIL PROTECTED] wrote:
$data .= #.ord(substr($string,$i,1)).;;
and I think there's no need for substr.. just
$data .= #.$string[$i].;;
/ahmed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Rodrigo de Oliveira Costa wrote:
Hi guys I have the following intention and would really like to know
if tis possible and if its possible how should it be done.
I have a string that is something like this:
INPUT TYPE=BUTTON Value='nbsp;nbsp;#171;nbsp;nbsp;'
On Mon, April 10, 2006 7:40 am, Andy wrote:
Hi to all,
I have the following pattern for a string:
text1 /ptext2 /otext3
Now, I want to extract the text by patterns from this string by the
following rule:
no pattern - text1 (what is before /o or /p)
/p - text2 (what is after /p)
/o -
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Monday, April 10, 2006 4:44 PM
To: php-general@lists.php.net
Subject: [PHP] String is not zero-terminated
In order to attempt to figure out why my script segfaults PHP (5.0.4,
5.1.2, 5.1.3RC3) I've been compiling
On Mon, April 10, 2006 4:40 pm, Kristen G. Thorson wrote:
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Monday, April 10, 2006 4:44 PM
To: php-general@lists.php.net
Subject: [PHP] String is not zero-terminated
In order to attempt to figure out why my script
On Mon, Apr 10, 2006 at 03:43:55PM -0500, Richard Lynch wrote:
In order to attempt to figure out why my script segfaults PHP (5.0.4,
5.1.2, 5.1.3RC3) I've been compiling --with-debug
That then gives me warnings such as:
Run-time warning. String is not zero-terminated () (source:
On Mon, April 10, 2006 6:14 pm, Curt Zirzow wrote:
One thing you might want to check is what is triggering this error,
if you are doing a strlen() call this error shouldn't be issued,
IMO. If operation you are doing rely's on the terminating \0, it
most likely should get fixed in php.
I'm
On 15/03/06, suresh kumar [EMAIL PROTECTED] wrote:
i am facing one problem in type casting.
$accno=2927;
$accno=$accno+1;
its o/p is 2928. but i want output to be 2928.i am
waiting response from u.
$accno = sprintf('%08d', $accno+1);
-robin
suresh kumar wrote:
i am facing one problem in type casting.
$accno=2927;
$accno=$accno+1;
its o/p is 2928. but i want output to be 2928.i am
my h/t is g/d but if d/l is w/h then I w/s but only if it's g/v
waiting response from u.
from what I gather your always waiting for a
i need to know how many bytes are in a string
example:
$string = blah;
string == how many bytes
Well, if you're willing to ignore all the unicode stuff, you can use
strlen() since 1 byte = 1 character. Check that manpage to see if there's
a unicode safe version.
also i need to know how
On Sun, Feb 12, 2006 at 08:13:42PM -0600, Philip Hallstrom wrote:
i need to know how many bytes are in a string
example:
$string = blah;
string == how many bytes
Well, if you're willing to ignore all the unicode stuff, you can use
strlen() since 1 byte = 1 character. Check that
On 6 Feb 2006, at 12:18, William Stokes wrote:
How can I test whether a string is 1 or 2 digits long?
Cast it to an int (or float if required) and strlen() it.
Cheers,
Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services
--
PHP General Mailing List
Cheers!
Richard Davey [EMAIL PROTECTED] kirjoitti
viestissä:[EMAIL PROTECTED]
On 6 Feb 2006, at 12:18, William Stokes wrote:
How can I test whether a string is 1 or 2 digits long?
Cast it to an int (or float if required) and strlen() it.
Cheers,
Rich
--
http://www.corephp.co.uk
Zend
[snip]
I want to validate a string for storage into a database so that it cannot
contain any content that might be interpreted as SQL, Javascript, PHP,
etc. Is there a standard function or technique to perform this validation?
[/snip]
The technique is regex (regular expressions), start here
On Mon, Dec 05, 2005 at 02:00:13PM -0500, Michael B Allen wrote:
I want to validate a string for storage into a database so that it cannot
contain any content that might be interpreted as SQL, Javascript, PHP,
etc. Is there a standard function or technique to perform this validation?
Trying to
Git the first set of tokens to an array, then walk that array retrieving
the subtokens.
Regards
babu wrote:
Hi,
I have different types of main strings seperated by commas(,). I want to tokenize the main string using php's string token function.
I have substrings in the main string which
In fact, this is a poor example since the difference gets larger with
longer
string and more arguments. When you use dots, the interpreter has to
actually concatenate the string, looking for memory to do so and freeing
it
up afterwards. This takes time. With commas, each argument is sent to
On 31 August 2005 16:56, [EMAIL PROTECTED] wrote:
$varname = '$firstname $lastname told me to find the file in folder
C:\newtext\'; echo $varname;
Yields..
$firstname $lastname told me to find the file in folder C:\newtext\
Actually, that'll give you an error as well, since \' is also
Wow! Fantastic rundown Satyam! Thanks for posting such a complete analysis. I
had no idea that you could use commas instead of periods to join multiple
strings much less do it without concatinating, that's very interesting.
I don't think I've ever seen that used in any sample code before.
Please keep in mind you are speaking about microseconds of performance
improvements. Optimising on this level is complete and utter nonsense.
Using output buffering may give your application a much higher
performance boost. And then you can still use a cache (opcode cache,
page cache, ...) which
On 8/31/05, Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote:
hi
i have a problem when i am formating a string
the problem is it converts the \n in the string to a new line
here is the code
?
$Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub;
$Replace =
hi
i have a problem when i am formating a string
the problem is it converts the \n in the string to a new line
here is the code
?
$Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub;
$Replace = D:\AppServ\www\intranet\admin\store;
$with = http://localhost/bank/admin/store;;
//$doc =
To elaborate on Philip's response (which is correct)...
Anything in double quotes ( ) will be interpreted by PHP before figuring out
what the actual value is. Items like \n, \t, etc are therefore converted to a
newline (\n) or a tab (\t) before assigning to the variable. Variables within
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
To elaborate on Philip's response (which is correct)...
[]
I've read never use double quotes unless you have to because it could
potentially speed up PHP a little because it won't be trying to interpret
every string.
I once
hi
i have a problem when i am formating a string
the problem is it converts the \n in the string to a new line
here is the code
?
$Text = D:\AppServ\www\intranet\admin\store\nodirectory\sub;
$Replace = D:\AppServ\www\intranet\admin\store;
$with = http://localhost/bank/admin/store;;
Use
[snip]
What I would like to be able to do is take a string and place it into a
'resource' so I can use functons like fscanf, fseek to process the
string.
Is this possible? If so, how?
p.s. While I would be interested in possible alternative solutions, I
would like to know how to accomplish
Jay Blanchard wrote:
[snip]
What I would like to be able to do is take a string and place it into a
'resource' so I can use functons like fscanf, fseek to process the
string.
Is this possible? If so, how?
p.s. While I would be interested in possible alternative solutions, I
would like to
[snip]
Jay Blanchard wrote:
If you place the string into a variable then you would be able to work
with it that way.
Using what functions?
Part of the point was not to need to keep track of the current location
in the string, etc...basically things that streams tend to handle well.
There
Jay Blanchard wrote:
[snip]
Jay Blanchard wrote:
If you place the string into a variable then you would be able to work
with it that way.
Using what functions?
Part of the point was not to need to keep track of the current location
in the string, etc...basically things that streams tend
[snip]
Again, I would like to treat the string as a stream.
One possible way to accomplish this would be to simply write the string
to a temporary file, open the file with fopen and then use fscanf,
fseek, etc. to process the text.
However, I am assuming there is an easier way (i.e. a method
Jay Blanchard wrote:
What, exactly, do you want to accomplish?
I want to be able to treat a string as a stream.
For example, the C++ STL contains istringstream, which allows one to
treat strings as streams.
(http://www.cplusplus.com/ref/iostream/istringstream/)
If you are truly wondering
[snip]
Jay Blanchard wrote:
What, exactly, do you want to accomplish?
I want to be able to treat a string as a stream.
[/snip]
I know C++ and I know what you are talking about here. As I said before,
you would have pretty high overhead to do this in PHP. However, if I
know what you want to do
Jay Blanchard wrote:
However, if I
know what you want to do with the string more specifically (I asked for
examples, which you have not given) I can get you to the right PHP
functions.
I am familiar with all of the PHP string functions.
PHP does not have a class or function similar to
[snip]
Neither solution was particularly appealing which is why I asked the
question.
[/snip]
I see. Sorry I couldn't be more helpful. And I thought you wore looking
for a more precise function rather than the whole lot of things that can
be accomplished with isstringstream.
--
PHP General
Eric Gorr wrote:
Again, I would like to treat the string as a stream.
One possible way to accomplish this would be to simply write the
string to a temporary file, open the file with fopen and then use
fscanf, fseek, etc. to process the text.
However, I am assuming there is an easier way
Jay Blanchard wrote:
[snip]
Neither solution was particularly appealing which is why I asked the
question.
[/snip]
I see. Sorry I couldn't be more helpful. And I thought you wore looking
for a more precise function rather than the whole lot of things that can
be accomplished with
[snip]
Looks like it wouldn't be terribly difficult to get something like this
up and running.
I was just taking a look at:
http://us3.php.net/manual/en/function.stream-wrapper-register.php
I'm kinda surprised no one has written a wrapper for strings yet...
[/snip]
Perhaps because there is
Eric Gorr wrote:
This should be a fairly easy question for someone who already knows the
answer...
What I would like to be able to do is take a string and place it into a
'resource' so I can use functons like fscanf, fseek to process the string.
Is this possible? If so, how?
Jochem Maas wrote:
http://php.net/manual/en/function.stream-wrapper-register.php is as
close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks
there is atleast
one other in agreement) - there is a reason php has all those built in
string functions :-)
And
But WHY WHY WHY would one want to treat a string as a stream, when PHP has
such good string handling functions?
THATS not been explained.
(Unless, knowing C and its limited string handling capabilities, one is
looking for a familiar hammer.)
It's Friday - time to go socialize - Miles
PS
Eric Gorr wrote:
Jochem Maas wrote:
http://php.net/manual/en/function.stream-wrapper-register.php is as
close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks
there is atleast
one other in agreement) - there is a reason php has all those built in
string
Jochem Maas wrote:
Eric Gorr wrote:
Jochem Maas wrote:
http://php.net/manual/en/function.stream-wrapper-register.php is as
close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks
there is atleast
one other in agreement) - there is a reason php has all those
[snip]
Well, as I mentioned before, you are welcome to look into the
surrounding useful examples for istringstream, etc. I can't think of a
single reason why similar reasons why istringstream, etc. is useful
would not apply to a php stream_wrapper for strings.
As for why things like
Eric Gorr wrote:
Jochem Maas wrote:
Eric Gorr wrote:
Jochem Maas wrote:
http://php.net/manual/en/function.stream-wrapper-register.php is as
close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks
there is atleast
one other in agreement) - there is a reason
Jay Blanchard wrote:
I have the potential for strings where the string will contain a front
slash;
index_Foo_Communications_c/o_Bar_Enterprises_20050718
I want to use the string to name a text file
index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt
but it always fails to open the file
[snip]
I'd say it would be best to keep that slash out of the filename. Do a
regex on the string before doing anything else
preg_replace ( /\//, -, $string );
[/snip]
That is what I ultimately told them, Don't do that. Of course they
looked at me like I was a space alien (which I am today,
Jay Blanchard wrote:
snip
BTW, my daughter got her learner's permit today!
Damn, you're old. ;)
I only have a 5yoso that must mean I'm still in my 20's, right? Right?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List
[snip]
BTW, my daughter got her learner's permit today!
Damn, you're old. ;)
[/snip]
You sure you want to say that today? I started late too, most of my high
school friends had their children starting in their 20's ...I was into
my 30's. She is my only child though.
[snip]
I only have a
Richard Lynch wrote:
On Tue, May 10, 2005 5:58 am, Merlin said:
I am writing an internal full text search engine and do have trouble in
outputting the text in an apropriate way.
Problem is that if there is more than one word I cant handle the text
cropping.
For example:
Search term: php germany
On Tue, May 10, 2005 5:58 am, Merlin said:
I am writing an internal full text search engine and do have trouble in
outputting the text in an apropriate way.
Problem is that if there is more than one word I cant handle the text
cropping.
For example:
Search term: php germany
Text from
On Tue, March 29, 2005 1:27 pm, René Fournier said:
I need to output a Hex value, e.g.:
686E8AF8
In the following format:
68 6E 8A F8
In other words, separated by spaces. Now I realize there are a million
ways to do this, but I would like a suggestion on which you think is
the most
I need to output a Hex value, e.g.:
686E8AF8
In the following format:
68 6E 8A F8
In other words, separated by spaces. Now I realize there
are a million
ways to do this, but I would like a suggestion on which you
think is
the most efficient? Incidentally, I'm starting
or if you aren't into regex (which I find confusing and still am trying
to learn):
Read the book Mastering Regular Expressions or first 300 pages of it - trust
me, it is worth the labour (personal experience)!
On Wednesday 23 February 2005 07:44, Ligaya Turmelle wrote:
if
Ashley M. Kirchner wrote:
How can I check that a string is no more than 6 characters long and
only contains alpha characters (no numbers, spaces, periods, hyphens, or
anything else, just letters.)
if(preg_match('/^[a-zA-Z]{0,6}$/',$string))
{ echo 'good'; }
else
{ echo 'bad'; }
Change to
or if you aren't into regex (which I find confusing and still am trying
to learn):
if ((strlen(trim($string)) =6) ctype_alpha(trim($string)))
{ echo 'good'; }
else
{ echo 'bad'; }
John Holmes wrote:
Ashley M. Kirchner wrote:
How can I check that a string is no more than 6 characters long
On 03 February 2005 19:40, Nuzzo Art-CINT116 wrote:
Is this a bug or am I missing something.
It's a bug -- see http://bugs.php.net/bug.php?id=30726
Reported fixed on 18-Jan-2005, so I guess you're looking at
4.3.11/5.0.4 to actually contain the fix.
Are there patches
Nuzzo Art-CINT116 wrote:
1 = -.15 + 0,
6 = -1.15 + 0,
[1] = 0
[6] = -1.15
Is this a bug or am I missing something.
Looks like a bug to me...
It's remotely possible that it's documented somewhere that -.15 doesn't
turn into a number, but that would be
Possible work-around:
I suspect that
$p1[14] = -0.15 + 0;
will do what you want, since the leading 0 will probably
trigger the regex properly.
Try it and see.
Changing it to -0.15 + 0 works. This data is actually coming from a numeric
field in an Oracle database using the OCI
Nuzzo Art-CINT116 wrote:
Possible work-around:
I suspect that
$p1[14] = -0.15 + 0;
will do what you want, since the leading 0 will probably
trigger the regex properly.
Try it and see.
Changing it to -0.15 + 0 works. This data is actually coming from a
numeric field in an Oracle database
On 03 February 2005 16:07, Nuzzo Art-CINT116 wrote:
I am not sure if this is a bug or I am just doing something
dumb but I am having a problem with automatic converting of
strings to a number between 0 and -1. For example:
1 = -.15 + 0,
[1] = 0
Is this a bug or am I
Is this a bug or am I missing something.
It's a bug -- see http://bugs.php.net/bug.php?id=30726
Reported fixed on 18-Jan-2005, so I guess you're looking at
4.3.11/5.0.4 to actually contain the fix.
Cheers!
Mike
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 25 January 2005 00:25, Ben Edwards wrote:
On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike
[EMAIL PROTECTED] wrote:
To view the terms under which this email is distributed,
[snip]
Being trying to work out haw to handle dates. Basically I need a
function to convert a Date to a String and another function to convert
a string to a date.
Exactly what format the date is held in is not relevant as long as it
is some type of standard (i.e. Unix Timestamps).
Both the
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
[EMAIL PROTECTED] wrote:
[snip]
String to Date Function
return date stringToDate( str Date, str Format )
e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
Date to String Function
How about the strtotime() function?
http://us4.php.net/manual/en/function.strtotime.php
From: Ben Edwards [EMAIL PROTECTED]
Date: 2005/01/24 Mon PM 12:03:34 EST
To: Jay Blanchard [EMAIL PROTECTED]
CC: PHP General List php-general@lists.php.net
Subject: Re: [PHP] String to Date and Date
, validate
it, and then convert it back to a timestamp.
I cant beleve the PHP date/time functions suck this bad;(
Ben
From: Ben Edwards [EMAIL PROTECTED]
Date: 2005/01/24 Mon PM 12:03:34 EST
To: Jay Blanchard [EMAIL PROTECTED]
CC: PHP General List php-general@lists.php.net
Subject: Re: [PHP
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 24 January 2005 17:04, Ben Edwards wrote:
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
[EMAIL PROTECTED] wrote:
[snip]
String to Date Function
[snip]
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How about the strtotime() function?
http://us4.php.net/manual/en/function.strtotime.php
No good, it douse not take a format string. What if I wanted to
convert the timestamp to 'DD-MM-YYY', display it on a
On Mon, 2005-01-24 at 11:03, Ben Edwards wrote:
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
[EMAIL PROTECTED] wrote:
[snip]
String to Date Function
return date stringToDate( str Date, str Format )
e.g. $todayDt = stringToDate(
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 24 January 2005 19:01, Ben Edwards wrote:
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
How about the strtotime() function?
Ben Edwards wrote:
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
How about the strtotime() function?
http://us4.php.net/manual/en/function.strtotime.php
No good, it douse not take a format string. What if I wanted to
convert the timestamp to 'DD-MM-YYY',
On Mon, 24 Jan 2005 19:22:40 -, Ford, Mike [EMAIL PROTECTED] wrote:
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 24 January 2005 17:04, Ben Edwards wrote:
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
On Mon, 24 Jan 2005 13:32:36 -0600, Jay Blanchard
[EMAIL PROTECTED] wrote:
[snip]
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
How about the strtotime() function?
http://us4.php.net/manual/en/function.strtotime.php
No good, it douse not take a format
On Tuesday 25 January 2005 08:07, Ben Edwards wrote:
As I have said in a previous email to date function takes a format
string and the strtodate douse not. Therefore the strtodate() only
works on a small subset of what date() can produce. The format I am
interested in is DD-MM- which is
On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike [EMAIL PROTECTED] wrote:
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 24 January 2005 19:01, Ben Edwards wrote:
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED]
On Tuesday 25 January 2005 08:09, Ben Edwards wrote:
Well, you could always write some extensions to PHP to cover it, as soon
as you learn to spell does :)
That is awfull grammer. Ime dyslexic, whats your excuse.
Does is spelt 'does' not 'douse', that grammar looks OK to me.
Was
Ben Edwards wrote:
The format I am
interested in is DD-MM- which is the way dates are specified in
the UK, strtodate() cant handle this.
Ben, there is no (built in) string-timestamp function that takes a
format. strtotime() is pretty smart about interpreting your input, but
it's limited to
On Friday 07 January 2005 07:32, Fredrik Arild Takle wrote:
I have a some problems doing a search and replace in a string.
I want to replace:
img ALT= src=base/image.php?id=3 border=0
with
img ALT= src=image.php?id=3 border=0
Note ALT, src, border properties may come in random order.
My
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 23 December 2004 07:39, Song Ken Vern-E11804 wrote:
Hi,
I have an array of array of strings :-
$g1 = array(453, 592);
$g2 = array(e14, e15, e13);
$groups = array($g1,
On Thursday 23 December 2004 15:39, Song Ken Vern-E11804 wrote:
print !--=$groups[$i][$j]=--\n; /* line?? */
to include :-
$cid = $groups[$i][$j];
print !--=$cid=--\n; /* line?? */
I seem to get the results I want.
Why is this? Is there a syntax error?
You need to change it to this:
On Wednesday 22 December 2004 08:18, John Holmes wrote:
It is, I guess.
?php
$a = ' ? ';
$b = ' ? ';
?
will work just fine. If you try to comment out either line, though, the PHP
processing will end at the ? and spit out the rest as plain text. So, text
can have as many ? as you want
* Thus wrote Jason Wong:
On Wednesday 22 December 2004 08:18, John Holmes wrote:
It is, I guess.
?php
$a = ' ? ';
$b = ' ? ';
?
will work just fine. If you try to comment out either line, though, the PHP
processing will end at the ? and spit out the rest as plain text. So,
Jason Wong wrote:
On Wednesday 22 December 2004 03:53, Richard Lynch wrote:
? can be caught by PHP as the end of PHP mode, no matter where you put
it
in a string or not.
You can't be serious? Or have I misunderstood you?
?php echo '?php ?'; ?
Works as expected, ie displays ?php ?.
From: Steve Brown [EMAIL PROTECTED]
Unexpected results:
If line 16 (indicated below) is commented out, the '?' in the string
on line 17 makes PHP stop parsing and the rest of the script is simply
dumped to stdout. If line 16 is NOT commented out, the '?' is NOT
picked up as being a PHP tag
On Wednesday 22 December 2004 01:12, Steve Brown wrote:
I'm working on a script that will parse through a long string using
regexs to pattern match a certain format. I'm having an issue with a
'?' in a string being picked up as an end-of-code character, but only
if the line before it is
Quote: The one-line comment styles actually only comment to the end of the
line or the current block of PHP code, whichever comes first. This means that
HTML code after // ? WILL be printed: ? skips out of the PHP mode and
returns to HTML mode, and // cannot influence that. If asp_tags
Steve Brown wrote:
I'm working on a script that will parse through a long string using
regexs to pattern match a certain format. I'm having an issue with a
'?' in a string being picked up as an end-of-code character, but only
No need to run it.
? can be caught by PHP as the end of PHP mode,
On Wednesday 22 December 2004 03:53, Richard Lynch wrote:
? can be caught by PHP as the end of PHP mode, no matter where you put it
in a string or not.
You can't be serious? Or have I misunderstood you?
?php echo '?php ?'; ?
Works as expected, ie displays ?php ?.
--
Jason Wong - Gremlins
You will notice
that the previous line also contains a '?' sequence, so I'm confused
as to why this would die on one line but not the other? Or is this
some freak combination of comments and PHP tags? :-o
It is, I guess.
?php
$a = ' ? ';
$b = ' ? ';
?
will work just fine. If you try
John W. Holmes wrote:
To detect them:
if(preg_match('/[^0-9a-zA-Z]/',$string))
{ echo 'bad characters present'; }
else
{ echo 'string okay'; }
or (faster):
if (!ctype_alnum($string)){
echo 'bad characters present';
} else {
echo 'string okay';
}
Aaron
--
PHP General Mailing List
-Original Message-
From: Brent Clements
To: [EMAIL PROTECTED]
I wanted to see if anyone has an easier way to do this. The end result
is this: I need to compare 7 different text strings(which are in an
array). They should all be the same, if they are not the same, a message
should be
if ( count ( array_unique ( $array ) ) == 1 ) {
// all fields have the same value
}
we could post solution to this problem for ever...
- Hannes
On Sat, 14 Aug 2004 15:24:03 +0100
[EMAIL PROTECTED] (Mike Ford) wrote:
-Original Message-
From: Brent Clements
To: [EMAIL PROTECTED]
I
* Ed Lazor wrote :
Nice solution =)
My thoughts exatly, :D
--
Kim Steinhaug
-
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
On Saturday 14 August 2004 23:12, Hannes Magnusson wrote:
if ( count ( array_unique ( $array ) ) == 1 ) {
// all fields have the same value
}
we could post solution to this problem for ever...
Indeed:
if (count(array_flip($doo)) 1) { // not same }
--
Jason Wong - Gremlins Associates -
if ( count ( array_diff ( $array, array ( $array[0] ) ) 0 ) { // not same }
On Sun, 15 Aug 2004 00:24:30 +0800
[EMAIL PROTECTED] (Jason Wong) wrote:
On Saturday 14 August 2004 23:12, Hannes Magnusson wrote:
if ( count ( array_unique ( $array ) ) == 1 ) {
// all fields have the same value
Let me rephase my question in my previous email:
I'd like to compare 7 strings(which are in an array). Each string should be
the same, if they are not, a message should be outputted. How would one do
this outside of using a huge if/then statement?
Thanks,
Brent
- Original Message -
sort ( $array );
if ( $array[ 0 ] !== $array[ count ( $array )-1 ] ) {
// Not all fields in the array are the same...
}
On Fri, 13 Aug 2004 21:10:50 -0500
[EMAIL PROTECTED] (Brent Clements) wrote:
Let me rephase my question in my previous email:
I'd like to compare 7 strings(which are in
101 - 200 of 407 matches
Mail list logo