PHP Knowledge Base Update -- August 3rd, 1999
[email protected] (Nathan Wallace) Wed, 4 Aug 1999 11:04:02 -0500
| Newsgroups | php.kb |
|---|---|
| Message-ID | <[email protected]> |
Ergin Soysal <[email protected]> announced the release of a syntax highlighted PHP editor with bookmarks, code templates and completion for free. The advantage of this editor is that you can run your script from this editor and see the output for debugging. Unfortunately it only runs under W95. http://www.soysal.com/PHPEd.zip Be warned, the only doc at this stage is: "Sorry, no docs yet.. But try "ctrl-J", "ctrl-K n" & "ctrl-Q n" (n is a number btw 0-9). You must download php for win32 and configure properly, then set the php path (File/preferences/PHP) to run your scripts within IDE. I need ideas, comments and bug reports of course ;-)" Personally, I use gVim (http://www.vim.org) under Linux. Cheers, Nathan ------------------------------------------------------------ How can I get the month number from the month name? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/527 ------------------------------------------------------------ Rasmus Lerdorf This function should do the job: function month_to_int($mon) { $months = array('Jan'=>1,'Feb'=>2,'Mar'=>3, 'Apr'=>4,'May'=>5,'Jun'=>6, 'Jul'=>7,'Aug'=>8,'Sep'=>9, 'Oct'=>10,'Nov'=>11,'Dec'=>12); return($months[$mon]); } i.e. I pass "Dec" and it returns 12 ------------------------------------------------------------ How can I create a variable in PHP with an ASP style Application scope? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/528 ------------------------------------------------------------ Rasmus Lerdorf If you want to store data across requests you need to use files, a database or shared memory. http://www.php.net/manual/variables.php3 ------------------------------------------------------------ How can I replace a single reg exp match using ereg_replace? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/529 ------------------------------------------------------------ Steve Edberg Well, I think you can do that via PHP's Perl-compatible regex support (since PHP 3.0.10, I think), but I haven't used that yet, so here's one way to do it using PHP's standard POSIX regex support: $RegEx = '-+'; # An example regex, that matches 1 or more dashes $ReplacementString = '-dashes-'; # what to replace the match with # Here's the meat of the procedure; the third param in split() is # the maximum of elements that the string will be split into. Using # 2 will split on the first occurence and ignore subsequent matches. $Parts = split($RegEx, $String, 2); $NewString = $Parts[0].$ReplacementString.$Parts[1]; ------------------------------------------------------------ Can PHP and ASP both be used in the same file? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/530 ------------------------------------------------------------ Jason Brooke PHP and ASP cannot be used in the same file. The web server must use one or the other to interpret the file. ------------------------------------------------------------ Can I submit a HTML form to an email address? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/532 ------------------------------------------------------------ Anand Raman, Christopher Ostmo For some browsers: <form name="form_name" action="mailto:[email protected]" enctype=plain/text method=post> </form> will work. After submitting the form u have the contents of the form in plain simple name / value pairs. You can find a PHP solution at: http://modems.rosenet.net/mysql/ Click the link to "Mail Form." ------------------------------------------------------------ Is the order of entries in an associative array guaranteed? What order are entries in an associative array returned by each()? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/533 ------------------------------------------------------------ John Coggeshall, Teodor Cimpoesu, Rasmus Lerdorf Say you have something like this: $myarray['a'] = 'a'; $myarray['b'] = 'b'; $myarray['c'] = 'c'; and do this: reset($myarray); while(list($key, $val) = each($myarray)) echo "Key: $key<br>"; It will print Key: a Key: b Key: c This first in first out order is guaranteed. ------------------------------------------------------------ How can I get the value of a string or char when treated as an integer? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/535 ------------------------------------------------------------ Gianluca Baldo Try the function intval(): http://www.php.net/manual/function.intval.php3 For example, $s = '23'; $i = intval($s); // $s is the string '23', $i is the integer 23 ------------------------------------------------------------ Does PHP support comma separated variable (csv) files? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/536 ------------------------------------------------------------ Egon Schmid Try this function: http://www.php.net/manual/function.fgetcsv.php3 ------------------------------------------------------------ How can I tell if a class is defined? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/537 ------------------------------------------------------------ Werner Stuerenburg You can do it this way: if(!defined("__PREPEND_INCLUDE_INC__")) include("$DOCUMENT_ROOT/php3/phplib6/prepend.php3"); and in prepend.php3, I begin with if(!defined("__PREPEND_INCLUDE_INC__")) define("__PREPEND_INCLUDE_INC__",1); ------------------------------------------------------------ Can I access Microsoft Exchange server's information store from PHP? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/538 ------------------------------------------------------------ Brian Schaffner You can do it using the COM controls on a Windows box. You can also use LDAP. You can't access everything in exchange via LDAP, but you can get user info and such.