Looks like a really simple piece of code except for the cryptic variable
names.
John Taylor-Johnston wrote:
$P1OC1Q1 = "1¶some text or some comment";
echo "Your score is: "; $score=split($P1OC1Q1,"¶"); echo $score[0]."\n";
Do I have to go through all that to get score[0] ?
John
--
Radi
Kind of hoping to do shorten it like this:
echo "Your score is: ".$score[0]=split($P1OC1Q1,"¶")."\n";
No such hopes?
> Looks like a really simple piece of code except for the cryptic variable names.
>
> >$P1OC1Q1 = "1¶some text or some comment";
> >echo "Your score is: "; $score=split($P1OC1Q1,"
>echo "Your score is: "; $score=split($P1OC1Q1,"¶"); echo
>$score[0]."\n";
>
>Do I have to go through all that to get score[0] ?
I think reset(split()) should work for getting the first element.
-
michal migurski- contact info an
Why not:
echo "Your score is:
".split($P1OC1Q1,"")."\n";
-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Sent: 17. ágúst 2003 03:48
To: [EMAIL PROTECTED]
Subject: Re: [PHP] [php] explode that :) !
Kind of hoping to do shorten it l
> Why not:
> echo "Your score is:
> ".split($P1OC1Q1,"¶")."\n";
Ok, but what happens when $P1OC1Q1 = "". It errors out.
$P1OC1Q1 = "";#left blank
$P1OC1Q2 = "1¶bunch of text";
$P1OC1Q3 = "1¶bunch of text";
$P1OC1Q4 = "1¶bunch of text";
$P1OC1Q5 = "1¶bunch of text";
$P1OC1Q6 = "1¶bunch of text";
"")."\n";
>
> -Original Message-----
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
> Sent: 17. ágúst 2003 03:48
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] [php] explode that :) !
>
> Kind of hoping to do shorten it like this:
>
&g
* Thus wrote John Taylor-Johnston ([EMAIL PROTECTED]):
> $P1OC1Q1 = "1¶some text or some comment";
>
> echo "Your score is: "; $score=split($P1OC1Q1,"¶"); echo
> $score[0]."\n";
>
> Do I have to go through all that to get score[0] ?
substr($P1OC1Q1, 0, strpos($P1OC1Q1, '¶')-1)
That will return
Hi,
Sunday, August 17, 2003, 12:58:23 PM, you wrote:
JTJ> $P1OC1Q1 = "1¶some text or some comment";
JTJ> echo "Your score is: "; $score=split($P1OC1Q1,"¶"); echo
$score[0]."\n";
JTJ> Do I have to go through all that to get score[0] ?
JTJ> John
if the number is always first and an integer:
e
On 17 August 2003 08:34, Tom Rogers wrote:
> Hi,
>
> Sunday, August 17, 2003, 12:58:23 PM, you wrote:
> > $P1OC1Q1 = "1¶some text or some comment";
>
> > echo "Your score is: ";
> $score=split($P1OC1Q1,"¶"); echo $score[0]."\n";
>
> > Do I have to go through all that to get score[0] ?
>
> > Jo
9 matches
Mail list logo