Re: [PHP] Novice question - please help
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! > > > > > > > > > $x = 0; > $ay=array(); > $g=array(); > $c = explode (' ', $a); > > >for($q=0;$q<=count($c);$q++) > { > echo""; > echo"$c[$q]"; > echo""; > echo""; > } > > > $c=array_reverse($c); > > > for($w = 0;$w > { > echo $w; > $e=array_pop($c); > if(($e == ' ')||($e == NULL)) > { > > echo"hi space"; > array_push($ay,$e); > echo""; > } > else > { > echo"hi no space"; > array_push($g,$e); > > } > } > > > > echo(count($g)); > > > > for($x=0;$x<=(count($g));$x++) > { > echo""; > echo"$g[$x]"; > echo""; > } > > ?> > > > > > > > > == > start page code > == > > > > > > npage.php > > > > > > > > enter polynomial here: > > > > > > > > > > > > _ > 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
Re: [PHP] Novice question - Please Help
On Wed, 30 Jan 2002 12:10:14 +, you wrote: >Could someone please email me and tell me how to split a string into >different arrays '); } /* I know it's weird, but use sizeof() for arrays, and strlen() for strings */ echo('$arr has ' . sizeof($arr) . ' elements'); echo('$str has ' . strlen($str) . ' characters'); ?> >and save what they were split on? Not sure what this means. >Also I cant get the sizeof function to work no matter what syntax i use, i >think ive tried them all, do you have to include a library or something in >your program to make it work? If the above doesn't work, then maybe there's something wrong with your install. djo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Novice question - Please Help
Take a look at split, explode > -Original Message- > From: brendan conroy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 30, 2002 1:10 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Novice question - Please Help > > > Hi, >thanks for reading this. Ive looked at every php site and > cant find an > answer, youre my last hope!(ok so its not that serious, but > pretty close!). > Could someone please email me and tell me how to split a string into > different arrays and save what they were split on? > Also I cant get the sizeof function to work no matter what > syntax i use, i > think ive tried them all, do you have to include a library or > something in > your program to make it work? > > Thanks a million, this isint a frivilous question, I looked > everywhere > before i came here, thanks, > > > > Bren > > _ > Join the world's largest e-mail service with MSN Hotmail. > http://www.hotmail.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > The information contained in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any form of disclosure, production, distribution or any action taken or refrained from in reliance on it, is prohibited and may be unlawful. Please notify the sender immediately. The content of the email is not legally binding unless confirmed by letter bearing two authorized signatures. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]