[PHP] Re: newbie array question
Hi Alexander, Have a look at the 'explode'-function (http://www.php.net/manual/en/function.explode.php). That should do the trick. Success! Sacha Telgenhof Alexander Ross [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... If I have a string variable that is already of the form ('item','item2','item3') [including the parens and quotes in the string], is there an easy way to change that variable into an array?? Array($var) doesn't work. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: newbie array question
Ignore my first reply. I didn't read the question properly. Sorry. Greetz, Sacha Telgenhof Alexander Ross [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... If I have a string variable that is already of the form ('item','item2','item3') [including the parens and quotes in the string], is there an easy way to change that variable into an array?? Array($var) doesn't work. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Constants
Thanks alot, I changed the reporting level. I found it myself later on. Just was a bit to quick when posting this question. Sacha Telgenhof John Holmes [EMAIL PROTECTED] wrote in message news:000d01c21f0c$de789bf0$b402a8c0@mango... Maybe it's already discussed here, but PHP is generating errors of undefined constants. These constants are defined in my scripts. Als the superglobal $_ENV is empty. Use quotes when using associative arrays. $_ENV['something'] rather than $_ENV[something] The warnings have always been there, PHP 4.2 just defaults to a higher error reporting level, so now you notice them. The problem comes from PHP looking for a constant called something and when it's not found, it issues a warning. Then it assumes you meant to use a string and tries it that way. You can adjust the error reporting in PHP.ini or with the error_reporting() function. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Constants
Hi, Maybe it's already discussed here, but PHP is generating errors of undefined constants. These constants are defined in my scripts. Als the superglobal $_ENV is empty. Can anyone tell what's wrong here? I'm using a W2K server, with Apache 1.3.26 and PHP 4.2.1 Thanks in advance, S. Telgenhof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formatting phone numbers
Hi Corinne, Maybe you have a look at the sprintf function in PHP http://www.php.net/manual/nl/function.sprintf.php It returns a string produced according to a formatting string (i.e. phonenumber) format. Also have look at the other formatting functions in PHP. Bye, Sacha Telgenhof Corinne Shea [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I'd like to write a function that will take a string of characters and output it in a phone number format (xxx)xxx- and one for credit cards ---. What I have below will currently remove non-numeric characters from the string, but I'm not sure how to do the rest of the formatting. Any help would be appreciated. By the way, any recommendations for good php tutorials for beginners? Thanks, Corinne html head title/title /head body ? function formatPhoneNum($prmValue) { $retrunValue=''; for($i=0; $istrlen($prmValue); $i++) { if(ereg('[0-9]', substr($prmValue, $i,1))) $returnValue.=substr($prmValue,$i,1); } return $returnValue; } ? ? $phoneNum= '415123kjdf4567'; ? pPhone Number: ?=formatPhoneNum($phoneNum)?/p /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php