RE: [PHP] [php] explode that :) !

2003-08-18 Thread Ford, Mike [LSS]
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 trtdYour score is: /tdtd;
 $score=split($P1OC1Q1,¶); echo $score[0]./td/tr\n;
 
  Do I have to go through all that to get score[0] ?
 
  John
 
 
 if the number is always first and an integer:
 
 echo trtdYour score is:
 /tdtd.intval($P1OC1Q1)./td/tr\n;

Or  (int)$P1OC1Q1

Or  $P1OC1Q1+0

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-17 Thread Curt Zirzow
* Thus wrote John Taylor-Johnston ([EMAIL PROTECTED]):
 $P1OC1Q1 = 1¶some text or some comment;
 
 echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo 
 $score[0]./td/tr\n;
 
 Do I have to go through all that to get score[0] ?

substr($P1OC1Q1, 0, strpos($P1OC1Q1, '¶')-1)

That will return every thing to the left of '¶'. and '' if nothing
is there without complaining.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-17 Thread Tom Rogers
Hi,

Sunday, August 17, 2003, 12:58:23 PM, you wrote:
JTJ $P1OC1Q1 = 1¶some text or some comment;

JTJ echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo 
$score[0]./td/tr\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:

echo trtdYour score is: /tdtd.intval($P1OC1Q1)./td/tr\n;

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-16 Thread [EMAIL PROTECTED]
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 trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo $score[0]./td/tr\n;

Do I have to go through all that to get score[0] ?

John

 



--

Raditha Dissanayake
-
http://www.radinks.com/sftp/
Lean and mean Secure FTP applet with Graphical User Inteface.
just 150 Kilo Bytes


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [php] explode that :) !

2003-08-16 Thread John Taylor-Johnston
Kind of hoping to do shorten it like this:

echo trtdYour score is: /tdtd.$score[0]=split($P1OC1Q1,¶)./td/tr\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 trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo 
 $score[0]./td/tr\n;
 
 Do I have to go through all that to get score[0] ?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-16 Thread Mike Migurski
echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo
$score[0]./td/tr\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 and pgp key:
sf/cahttp://mike.teczno.com/contact.html


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] [php] explode that :) !

2003-08-16 Thread Sævar Öfjörð
Why not:

echo trtdYour score is:
/tdtd.split($P1OC1Q1,)./td/tr\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:

echo trtdYour score is:
/tdtd.$score[0]=split($P1OC1Q1,¶)./td/tr\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 trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶);
echo $score[0]./td/tr\n;
 
 Do I have to go through all that to get score[0] ?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-16 Thread John Taylor-Johnston
 Why not:
 echo trtdYour score is:
 /tdtd.split($P1OC1Q1,¶)./td/tr\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;




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [php] explode that :) !

2003-08-16 Thread John Taylor-Johnston
Actually this does not work:

echo split($P1OC1Q1,¶);

There are two variables in $P1OC1Q1 = 1¶a bucnh of text
I want to split $P1OC1Q1 and get 1 as a numeral for a calculation. I was looking for 
a cleaner way to do it.

$P1OC1Q1 = 1¶some text or some comment;
echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶);
echo $score[0]./td/tr\n;

My problem becomes more difficult when $P1OC1Q1 = ;
Split errors out.


SævË Ölêöyp wrote:

 Why not:

 echo trtdYour score is:
 /tdtd.split($P1OC1Q1,)./td/tr\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:

 echo trtdYour score is:
 /tdtd.$score[0]=split($P1OC1Q1,¶)./td/tr\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 trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶);
 echo $score[0]./td/tr\n;
  
  Do I have to go through all that to get score[0] ?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php