Re: [php] explode that :) !
| From: | John Taylor-Johnston | Date: | Sun, 17 Aug 2003 05:45:21 +0000 |
| Subject: | Re: [php] explode that :) ! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159823@lists.php.net to get a copy of this message | ||
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 "<tr><td>Your score is: </td><td>";
$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 "<tr><td>Your score is:
> </td><td>".split($P1OC1Q1,"")."</td></tr>\n";
>
> -----Original Message-----
> From: John Taylor-Johnston [mailto:taylorjo@collegesherbrooke.qc.ca]
> Sent: 17. ágúst 2003 03:48
> To: php-general@lists.php.net
> Subject: Re: [PHP] [php] explode that :) !
>
> Kind of hoping to do shorten it like this:
>
> echo "<tr><td>Your score is:
>
> </td><td>".$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 "<tr><td>Your score is: </td><td>";
> > >$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