FAQ

Search Discussions

947 discussions - 1,507 posts

  • As brion at pobox dot com points out, you should be very careful with magic quotes and file uploads. I found that with magic quotes gpc turned on, filenames that have a quote in it, get stripped ...
    Znoob2Znoob2
    Sep 25, 2005 at 9:42 am
    Sep 25, 2005 at 11:40 am
  • I have been having issues with putting data in to an MSSQL database from an uploaded file. Trying to INSERT a file in excess of 25MB caused "Insufficient memory" errors from the SQL server I decided ...
    No_lewis_spamNo_lewis_spam
    Sep 3, 2005 at 5:23 pm
    Jan 23, 2011 at 4:55 pm
  • On RHEL for PHP4 or 5... For Oracle 9i before you compile PHP but after you install Oracle, you need to make the following symlinks: ln -s $ORACLE_HOME/rdbms/public/nzerror.h ...
    JistanidiotJistanidiot
    Sep 16, 2005 at 4:03 pm
    Jun 26, 2009 at 6:26 pm
  • /* Here is a script that is usefull to : - login to a POST form, - store a session cookie, - download a file once logged in. */ // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN ...
    RoxortRoxort
    Sep 21, 2005 at 3:04 pm
    May 17, 2009 at 7:33 pm
  • # m.ozarek # # Check if given mask is correct. You can check the short format mask # like 8,16,24 or long format like 255.255.255.0 # function isIpMask($mask){ $format = ''; ...
    Php-generalPhp-general
    Sep 1, 2005 at 8:44 pm
    Dec 5, 2008 at 1:28 pm
  • The DBG Php Debugger website can be found at http://dd.cron.ru/dbg/ The URL given previously (http://www.dd.cron.ru/dbg/) does not work ---- Manual Page -- ...
    DayDay
    Sep 5, 2005 at 1:22 pm
    Nov 28, 2008 at 7:31 pm
  • I´ve noticed that on some servers one need to put "or die(mysql_error())" when you use mysql_num_rows(), or else it will throw an error. :S ---- Manual Page -- ...
    ThismelancholyThismelancholy
    Sep 29, 2005 at 11:22 am
    Apr 18, 2008 at 10:52 pm
  • // Redirects the browser quickly header("Refresh: 0; http://www.php.net"); echo "This content is usually displayed by the browser in the instant before the next page can be loaded."; i use this in my ...
    DigibluezDigibluez
    Sep 5, 2005 at 11:08 pm
    Mar 27, 2006 at 9:42 am
  • A small improvement to the my_array_delete_by_key() function submitted on 2-Sep, 2005: <?php function my_array_delete_by_key($array, $item) { if (array_key_exists($item, $array)) ...
    MoxleystrattonMoxleystratton
    Sep 4, 2005 at 7:51 pm
    Oct 9, 2005 at 10:06 am
  • The complete list of timezones is available from the source code. http://viewcvs.php.net/viewcvs.cgi/ php-src/ext/date/lib/timezonedb.h?rev=1.4.2.2 (url split as it's too long for the note parser) I ...
    DavidDavid
    Sep 6, 2005 at 7:02 am
    Oct 8, 2005 at 7:18 pm
  • What's the purpose of apd_callstack, since it sounds identical to debug_backtrace, but without the conveniance of being a built-in? ---- Manual Page -- ...
    Php-generalPhp-general
    Sep 30, 2005 at 8:16 pm
    Oct 1, 2005 at 11:14 am
  • <?php // Swap 2 elements in array preserving keys. function array_swap(&$array,$key1,$key2) { $v1=$array[$key1]; $v2=$array[$key2]; $out=array(); foreach($array as $i= $v) { if($i==$key1) { $i=$key2; ...
    ZaZa
    Sep 27, 2005 at 3:57 pm
    May 6, 2014 at 10:02 pm
  • I ran into a situation where I only wanted to sum elements of an array for certain keys. For that, I wrote this function <? function array_sum_by_key() { $args = func_get_args(); $arr = ...
    MroachMroach
    Sep 27, 2005 at 9:01 pm
    Mar 18, 2014 at 7:44 pm
  • Not sure if this is obvious to everyone, but if you pass an object by reference into a function and then set that variable to the reference of a new object, the initial variable outside the function ...
    RmarscherRmarscher
    Sep 15, 2005 at 11:37 pm
    Feb 23, 2014 at 5:14 pm
  • to load a php file to a variable then execute it, try this <?php $code=file_get_contents("file.php"); $code=str_replace('<'.'?php','<'.'?',$code); $code='?'.' '.trim($code).'<'.'?'; eval($code); ? ...
    MattMatt
    Sep 10, 2005 at 6:19 pm
    Dec 9, 2013 at 12:00 pm
  • Based on the code posted by gaylord dot aulke at 100days.de i wrote this one. This should implement this function in all versions equal or greater than PHP 4.0 function array_intersect_key($arr1, ...
    SilvioginterSilvioginter
    Sep 23, 2005 at 1:12 pm
    Oct 22, 2013 at 2:54 pm
  • When upgrading my redhat server to enterprise 4, selinux was turned on. This caused one of my php scripts (that uses passthru) to fail. After some nice help from redhat, I was able to get the script ...
    WaldowWaldow
    Sep 22, 2005 at 3:55 pm
    Oct 22, 2013 at 2:54 pm
  • I've been using the php ftp functions pretty extensively at work. We've recently discovered that some of the ftp servers we connect to, paticularly in Europe, are using extended passive mode. On a ...
    Chris PittmanChris Pittman
    Sep 15, 2005 at 2:30 pm
    Oct 22, 2013 at 2:54 pm
  • In reply to what kerosuppi posted: [quote]This does not work as expected.[/quote] No, it works exactly as expected. The call <?php parse_str($this- query_string);? "sets variables in the current ...
    EtEt
    Sep 1, 2005 at 11:11 am
    Oct 22, 2013 at 2:54 pm
  • There's a printable PDF PCRE cheat sheet available here: http://www.phpguru.org/article.php?ne_id=67 Has the common metacharacters, quantifiers, pattern modifiers, character classes and assertions ...
    RichardhRichardh
    Sep 22, 2005 at 7:45 pm
    Oct 2, 2013 at 8:35 pm
  • Here's a short function that can export php arrays to javascript arrays. <?php function php_to_js($array, $base) { $js = ''; foreach ($array as $key= $val) { if (is_array($val)) { $js .= ...
    Jamin42bJamin42b
    Sep 2, 2005 at 1:48 pm
    Jul 12, 2013 at 4:23 pm
  • I wrote this because I wanted users to be able to do basic layout formatting by hitting enter in a textbox but still wanted to allow HTML elements (tables, lists, etc). The problem was in order for ...
    ThunbergThunberg
    Sep 14, 2005 at 7:11 am
    Jun 13, 2013 at 11:11 am
  • In response to the comment by Neoja regarding validating every variable in the URL using settype -- that is wrong. All value passed in the URL are strings, even if they are numbers. (Remember, they ...
    Php-generalPhp-general
    Sep 25, 2005 at 9:19 pm
    Feb 2, 2013 at 3:15 pm
  • The curl-functions can be used to check the ICQ-webstatus from an icq-number, to get the status as a string rather than as one of those standard images provided from ICQ. This can also be used to ...
    Ru DyRu Dy
    Sep 2, 2005 at 11:06 pm
    Jan 19, 2013 at 3:40 am
  • Use get_defined_constants() to retrieve these constants. <?php print '<pre '; print_r(get_defined_constants()); print '</pre '; ? ---- Manual Page -- ...
    TeaboreTeabore
    Sep 28, 2005 at 8:04 pm
    Oct 12, 2012 at 7:34 am
  • After recieving a "bogus" mark on a bug report i've tried to find out the differences between cache_expire and what was causing a session delete after 24 minutes. cache_expire is used for cached ...
    ATAT
    Sep 23, 2005 at 3:16 pm
    Sep 14, 2012 at 5:32 am
  • Trying to make an effiecient word splitter, and "paragraph limiter", eg, limit item text to 100, or 200 words and so-forth. I don't know how well this compares, but it works nicely. function ...
    WebmasterWebmaster
    Sep 26, 2005 at 12:54 am
    Aug 31, 2012 at 4:28 pm
  • My example of this function for PHP versions < PHP5 without any regular expressions, just cycles, recursion and standard functions. It can work with complex arrays or objects or both combined. <?php ...
    Vlad_mustafinVlad_mustafin
    Sep 29, 2005 at 12:26 pm
    Aug 2, 2012 at 1:36 pm
  • Correctly initializing all variables, this would become: function implode_with_key($assoc, $inglue = '=', $outglue = '&'){ $return = ''; foreach ($assoc as $tk = $tv) { $return = ($return != '' ? ...
    PeterhopfgartnerPeterhopfgartner
    Sep 27, 2005 at 3:21 pm
    Aug 2, 2012 at 1:17 pm
  • Another variation on implode_with_key: <?php function implode_with_key($assoc, $inglue = '=', $outglue = '&') foreach ($assoc as $tk = $tv) { $return = (isset($return) ? $return . $outglue : '') . ...
    PhpPhp
    Sep 9, 2005 at 5:18 pm
    Aug 2, 2012 at 1:16 pm
  • Just a word of caution when looping through a batch of strings (in the thousands or more). Using trim to take off a left over character (like a comma in a csv output) will result in a much slower ...
    Davis_utahDavis_utah
    Sep 1, 2005 at 7:27 pm
    Aug 2, 2012 at 12:23 pm
  • NOTE: as from php-5.0.5, objects are destroyed BEFORE the session_write() is called! So if you use an object as custom session handler, your writes will fail, as at the moment of write the object is ...
    Rudy MetzgerRudy Metzger
    Sep 21, 2005 at 2:13 pm
    Mar 11, 2012 at 2:19 am
  • I created a routine that fills an array with the dates in the current week. For example $WeekDays[0] is sunday's date, $WeekDays[1] is monday's date and so on no matter what day of the week it is ...
    KbrillKbrill
    Sep 15, 2005 at 4:23 pm
    Feb 9, 2012 at 9:07 pm
  • I've been using the great replace_num_entity function posted below. But there seems to be some problems with the 128 to 160 characters range. Ie, try: <?php header("Content-type: text/html; ...
    EmilianomartinezluqueEmilianomartinezluque
    Sep 26, 2005 at 1:17 am
    Jan 10, 2012 at 8:13 pm
  • hey, i came across this afew weeks ago and used the function in an app for recording info about domains that my company owns, and found that the status this returns was wrong most of the time (400 ...
    StuartStuart
    Sep 14, 2005 at 8:48 pm
    Jan 9, 2012 at 8:00 pm
  • my version cleans the input URL a little bit (you should be able to put in almost every shit, and it should still work) Should work for: http://test.de http://test.de/ www.test.de http://test.de/ ...
    TylerxxdurdenTylerxxdurden
    Sep 24, 2005 at 7:49 pm
    Jan 9, 2012 at 8:00 pm
  • /* geoCode($address) Accepts an address in the form of 999 Geocode Dr. New York, Ny 10108 returns array with lat and lon */ function geoCode($address) { $gaddress = "http://maps.google.com?q=" . ...
    AdamgambleAdamgamble
    Sep 21, 2005 at 3:55 am
    Jan 6, 2012 at 9:10 pm
  • i fixed the resume download function since there were few bugs in it. here it goes changes: - i added "partial content" header - added "bytes" to the first content-range header - changed _ENV to ...
    XjustXjust
    Sep 28, 2005 at 9:01 am
    Jan 6, 2012 at 9:09 pm
  • As noted in some examples below, strrpos does not act the same on every platform! On Linux, it returns the position of the end of the target On Windows, it returns the position of the start of the ...
    Nh_handymanNh_handyman
    Sep 22, 2005 at 12:23 pm
    Dec 25, 2011 at 12:50 am
  • It can be very useful to pass the third (optional) parameter by reference while modifying it permanently in callback function. This will cause passing modified parameter to next iteration of ...
    AndrzejmartynowiczAndrzejmartynowicz
    Sep 19, 2005 at 1:58 am
    Aug 22, 2011 at 1:06 pm
  • It took me almost 30 minutes to find out what was wrong in my code. I thought I had defined all constants correctly: correct quotes, and whatnot. The problem: I am a C programmer and I used #define ...
    A EibachA Eibach
    Sep 1, 2005 at 10:07 am
    Jul 26, 2011 at 8:01 pm
  • Being a belt and suspenders person, when I use a constant to do flow control (i.e., using constants to determine which version of a section of the program should be used), I always use something ...
    KencomerKencomer
    Sep 14, 2005 at 1:33 pm
    Jul 26, 2011 at 7:31 pm
  • It seems that the best solution would be to use HMAC-MD5. An implementation of HMAC-SHA1 was posted by mark on 30-Jan-2004 02:28 as a user comment to sha1() function (- ...
    Mina86attlendotplMina86attlendotpl
    Sep 19, 2005 at 9:36 pm
    Jul 17, 2011 at 8:42 am
  • Re ks: Your function does something different if $padchar is not a chararcter but rather a string. Still, however, private's function may be simplified: <?php function str_pad_right($str, $pad, $len) ...
    MichalnazarewiczMichalnazarewicz
    Sep 24, 2005 at 11:22 am
    Jul 2, 2011 at 6:53 pm
  • In responce to astrolox; This is because the numbers generated by performing math are double precision (which means pretty darn accurate) and not perfect precision (which would be what you get when ...
    AjathotmaildotcomAjathotmaildotcom
    Sep 30, 2005 at 5:13 pm
    Jun 20, 2011 at 3:17 pm
  • FriBiDi is the example of the pollutions convoluted by the distraction found in the loss of example inutero of the interest confounded by the dissentary lossenge in each of the loud particles. The ...
    Jibble_1Jibble_1
    Sep 19, 2005 at 7:23 pm
    Mar 29, 2011 at 11:54 am
  • Yet another Array_Unique for multi-demensioned arrays. I've only tested this on two-demensioned arrays, but it could probably be generalized for more, or made to use recursion. This function uses the ...
    KenrbnsnKenrbnsn
    Sep 27, 2005 at 5:04 am
    Jan 23, 2011 at 5:15 pm
  • Slight modification of write_ini_file that will keep values global in an array if they appear after an array <?php function write_ini_file($path, $assoc_array) { $content = ''; $sections = ''; ...
    WickedfatherWickedfather
    Sep 13, 2005 at 8:15 am
    Jan 23, 2011 at 5:04 pm
  • Hi there, As Singleton patterns are used for years in Java, today we tend toward overriding 'new' operator (as singleton returns always the same instance for every 'new' that you call...). In order ...
    RashkatsaRashkatsa
    Sep 30, 2005 at 12:58 pm
    Jan 23, 2011 at 4:37 pm
  • gk at lka dot hu: I've removed a few errors and moved both functions into one. The line with the prefix-check did'nt work right. <?php function CompareUmlaut($astring, $bstring) { $ALP = ...
    Markus MeierMarkus Meier
    Sep 15, 2005 at 7:49 pm
    Jan 23, 2011 at 4:18 pm
Group Navigation
period‹ prev | Sep 2005 | next ›
Group Overview
groupphp-notes @
categoriesphp
discussions947
posts1,507
users736
websitephp.net

736 users for September 2005

Nuno Lopes: 181 posts Betz: 146 posts Mazzanet: 129 posts Php-general: 98 posts : 45 posts Jome: 37 posts Aidan: 22 posts Jacques: 15 posts Sean: 14 posts Derek: 12 posts Kencomer: 10 posts Ludvigdotericsonatgmaildotcom: 8 posts Hans: 7 posts Cece: 5 posts Vrana: 5 posts Techtonik: 5 posts Php: 4 posts Phpdoc: 4 posts Komashooter: 4 posts YassinEzbakhe: 4 posts
show more
Archives