use str_replace() instead of ereg_replace() ...in the same way described
----- Original Message -----
From: "brendan conroy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 11, 2002 9:15 PM
Subject: [PHP] Novice question - please help


> Hi,
>    THANK YOU for reading this.I would really appreciate it if someone
could
> please email me if they know any easy way or an existing function for
> removing an unknown ammount of space characters from an array.
>
> Iam having an awful lot of trouble trying to remove multiple space
> characters from an array,
>
>   ie.   x   +   y
>         123456789
>
> where there are three or more spaces in a row(rep'd above by 234 & 678),
> basically weird user input.
>
> I have written code already, but I cant see where Ive gone wrong, here it
is
> if you care to look at it, and have a good chuckle, told you I was a
novice!
> I included the start page that allows you to see what the code does, in
you
> want to look at it.
> Thank you for your time, I'd really appreciate any replies!
>
>
> <HTML>
> <BODY>
>
>
> <?
>
>
> $x = 0;
> $ay=array();
> $g=array();
> $c = explode (' ', $a);
>
>
>    for($q=0;$q<=count($c);$q++)
> {
> echo"<font color=green>";
> echo"$c[$q]";
> echo"<HR>";
> echo"</font>";
> }
>
>
> $c=array_reverse($c);
>
>
> for($w = 0;$w<count($c);$w++)
>
> {
> echo $w;
> $e=array_pop($c);
> if(($e == ' ')||($e == NULL))
> {
>
> echo"hi space";
> array_push($ay,$e);
> echo"<HR>";
> }
> else
> {
> echo"hi no space";
> array_push($g,$e);
>
> }
> }
>
>
>
> echo(count($g));
>
>
>
> for($x=0;$x<=(count($g));$x++)
> {
> echo"<BR>";
> echo"$g[$x]";
> echo"<HR>";
> }
>
> ?>
>
> </BODY>
> </HTML>
>
>
>
>
> ==============================
> start page code
> ======================
>
>
>
> <html>
> <head>
> <title>npage.php</title>
>
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
>
>
> <form action="newplan2.php" method=post>
> enter polynomial <? echo "$i";?> here:<input type="text" name="a">
>
> <input type="submit" name="submit" value="Submit Pols!">
>
>
>
> </body>
> </html>
>
>
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> 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

Reply via email to