FAQ

Search Discussions

586 discussions - 1,113 posts

  • With Oracle 11gR2, prefetching also works when fetching from REF CURSORS and nested queries. To use a non default prefetch count, use oci_set_prefetch. For example, on the REF CURSOR statement ...
    SixdSixd
    Oct 7, 2009 at 12:47 am
    Oct 7, 2009 at 2:36 am
  • lot of people said that there is bug in strtotime method like given in this example: echo date( "Y-m-d", strtotime( "2009-01-31 +1 months" ) )."<br "; this gives 03-03-2009 instead of 28-02-2009 here ...
    Flexibill2001Flexibill2001
    Oct 9, 2009 at 7:27 am
    Dec 14, 2014 at 11:33 am
  • Because I had a lot of problems with number_format, here is a working, simple and small replacement: function FormatNumber($number, $decimals = 0, $thousand_separator = '&nbsp;', $decimal_point = ...
    HorvathHorvath
    Oct 5, 2009 at 8:29 pm
    Mar 23, 2014 at 2:12 pm
  • PHP-CGI auth fix: if(isset($_SERVER['HTTP_AUTHORIZATION'])) { $auth_params = explode(":" , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); $_SERVER['PHP_AUTH_USER'] = $auth_params[0]; ...
    AdminAdmin
    Oct 29, 2009 at 6:09 pm
    Oct 22, 2013 at 11:18 am
  • Another getDirectoryTree with filters: function getDirectoryTree( $outerDir, $filters = array() ){ $dirs = array_diff( scandir( $outerDir ), array_merge( Array( ".", ".." ), $filters ) ); $dir_array ...
    DustinDustin
    Oct 27, 2009 at 7:57 pm
    Oct 22, 2013 at 11:18 am
  • If you don't want the output of your command echoed to STDOUT while using PHP for scripting (Unix/CLI) use exec() instead of system(). May apply to CGI versions, YMMV. <? $cmd = "date"; $output = ...
    CaCa
    Oct 26, 2009 at 8:37 am
    Oct 22, 2013 at 11:18 am
  • If you're looking to output an Excel format (.xls) file, consider using PEAR's Spreadsheet_Excel_Writer instead: (url too long so broken up) http://pear.php.net/manual ...
    BenBen
    Oct 15, 2009 at 4:51 pm
    Oct 22, 2013 at 11:17 am
  • Here is a very concise replacement for str_getcsv. No escaping of the enclosure char though, but an additional possibility to preserve the enclosing characters around a field. Note that the fourth ...
    JrgwagnerJrgwagner
    Oct 12, 2009 at 9:12 pm
    Oct 22, 2013 at 11:17 am
  • SimpleXML Objects are different, even if made from the same XML. <?php // RAY_SimpleXML_compare.php error_reporting(E_ALL); echo "<pre \n"; // TWO SimpleXML OBJECTS ARE NOT EQUAL WITH COMPARISON ...
    RpaseurRpaseur
    Oct 8, 2009 at 10:59 pm
    Oct 22, 2013 at 11:17 am
  • fopen('/dev/stdin/') no longer works use fopen('php://stdin') instead Cheers, Scott http://www.synergy8.com/ ---- Server IP: 117.55.229.1 Probable Submitter: 58.6.144.8 ---- Manual Page -- ...
    Scott McnaughtScott Mcnaught
    Oct 7, 2009 at 2:25 pm
    Oct 22, 2013 at 6:48 am
  • I was a little slow on the uptake for the same question Vameza describes. Here is a contrasting set of code that outlines the difference. function a($n){ b($n); return ($n * $n); } function b(&$n){ ...
    RaashellRaashell
    Oct 5, 2009 at 11:07 pm
    Jan 19, 2013 at 3:39 am
  • On Windows Vista or above, an entry in the Windows/System32/drivers/etc/hosts file causes mysql_connect() connections to "localhost" to timeout and never connect. This happens on php 5.3 and above ...
    BrucekirkpatrickBrucekirkpatrick
    Oct 28, 2009 at 5:36 pm
    Jan 12, 2013 at 9:22 pm
  • BEWARE! json_decode will NOT WORK if there ARE LINE BREAKS in the JSON! Use str_replace to get rid of them. ---- Server IP: 92.48.74.199 Probable Submitter: 81.108.167.114 ---- Manual Page -- ...
    SimonkenyonshepardSimonkenyonshepard
    Oct 14, 2009 at 6:12 pm
    Nov 30, 2012 at 5:40 am
  • function array_two_key_swap( $multidimensional_array ) { /* Writen by: Leonardo Martinez Contact: http://www.leonardomartinez.com/contact/ Created: 10-10-2009 Modified: 10-15-2009 This function takes ...
    MailMail
    Oct 10, 2009 at 8:28 pm
    Jun 22, 2012 at 9:53 pm
  • I discovered that when using the @abstract tag from php-doc my ide will give the option to implement all abstract methods automaticly. many developers know this feature from Java ide's like ...
    M HofrichterM Hofrichter
    Oct 26, 2009 at 10:58 am
    Sep 18, 2010 at 5:32 pm
  • Date Validation Code function validDate($date){ //replace / with - in the date $date = strtr($date,'/','-'); //explode the date into date,month and year $datearr = explode('-', $date); //count that ...
    OmikrosysOmikrosys
    Oct 13, 2009 at 11:29 am
    Aug 15, 2010 at 6:42 pm
  • 1. Find whether an year is a leap year or not. 2. Find the number of days in a given month of a year. code - function leapYear($year){ if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 != 0)) ...
    DevDev
    Oct 15, 2009 at 6:03 am
    Aug 15, 2010 at 6:42 pm
  • Want to display the acutal character represented by Unicode Code Annotation U+.. for example U+00CE ? The unicode_to_utf8 you find in comments futher will help us, but it requires as argument an ...
    NicolaenamolovanNicolaenamolovan
    Oct 18, 2009 at 12:07 pm
    Apr 12, 2010 at 4:53 pm
  • With Oracle 11gR2, prefetching also works when fetching from REF CURSORS and nested queries. To use a non default prefetch count, use oci_set_prefetch. For example, on the REF CURSOR statement ...
    SixdSixd
    Oct 7, 2009 at 3:06 am
    Nov 13, 2009 at 12:34 am
  • I found this useful for appending onto an array without writing over previous values <? $ar[0] = "value"; $ar[sizeof($ar)] = "newvalue"; print_r($ar); ? ---- Server IP: 69.147.83.197 Probable ...
    Falkon303Falkon303
    Oct 15, 2009 at 10:00 pm
    Nov 7, 2009 at 6:29 pm
  • <?php //This will not work if(checkdnsrr("round-robin-example.com"),"ALL")){ ^----------------- I think not functions return true; }else{ return false; } //But every value other than "ANY" will work ...
    Felix E UrbinaFelix E Urbina
    Oct 5, 2009 at 2:16 pm
    Oct 14, 2009 at 4:10 am
  • Two SimpleXML objects do not compare 'equal' even if made from the same XML. <?php // RAY_SimpleXML_compare.php error_reporting(E_ALL); echo "<pre \n"; // TWO SimpleXML OBJECTS ARE NOT EQUAL WITH ...
    CeoCeo
    Oct 8, 2009 at 11:02 pm
    Oct 9, 2009 at 1:29 am
  • here is a simple function to compare dates and build ranges. <?php $germanDates = array('10.10.2009','25.12.2009', '01.02.2009','11.10.2009', '12.10.2009','13.10.2009', '11.10.2010','01.03.2010', ...
    Heiko DresslerHeiko Dressler
    Oct 22, 2009 at 3:16 pm
    Nov 3, 2013 at 3:22 pm
  • Just a reverse sorting function for "natural order" algorithm: <?php function natrsort(&$array) { natsort($array); $array = array_reverse($array); } $arr = array("img12.png", "img2.png", "img1.png", ...
    Kirik-sanatusers Sourceforge NetKirik-sanatusers Sourceforge Net
    Oct 30, 2009 at 3:59 am
    Oct 22, 2013 at 11:18 am
  • This function accepts LDAP search results and return a flat table (2-d array) with search results. <?php /* * This function returns flat table out of search results * $ad - a valid connection to ...
    EugeneEugene
    Oct 25, 2009 at 6:24 am
    Oct 22, 2013 at 11:17 am
  • I discovered that socket_read() was not always grabbing the length that I requested. If I requested 1024 bytes, it may return any number smaller than that. Well, due to the nature of network traffic, ...
    PhilthathrilPhilthathril
    Oct 19, 2009 at 5:38 pm
    Oct 22, 2013 at 11:17 am
  • When checking whether to addslashes, use get_magic_quotes_runtime(). Using get_magic_quotes_gpc() may not be accurate. ---- Server IP: 69.147.83.197 Probable Submitter: 69.143.2.239 ---- Manual Page ...
    AdamAdam
    Oct 19, 2009 at 3:05 am
    Oct 22, 2013 at 11:17 am
  • If you are using __autoload to dynamically load your classes, then __invoke won't work. Calling a class like SomeClass() will give and error in this case as it is evaluated first as a function, not ...
    Vad ViktorVad Viktor
    Oct 15, 2009 at 9:55 am
    Oct 22, 2013 at 11:17 am
  • There are issues with most examples of converting a simplexml object into an array recursively. The situation that fails is when you have a value for an element and attributes. For example: <results ...
    SpcmkySpcmky
    Oct 14, 2009 at 5:38 pm
    Oct 22, 2013 at 11:17 am
  • Most of the xml 2 array functions listed here fail when they encounter the following xml: <something code="231" type="open" Value</something The attributes get dropped. ---- Server IP: 69.147.83.197 ...
    SpcmkySpcmky
    Oct 13, 2009 at 8:39 pm
    Oct 22, 2013 at 11:17 am
  • After 2 hours of head scratching, I finally came across a PHP bug filed in 2002 about sending multiple Set-Cookie headers. This may be a no-brainer to some, but make sure you set the 2nd param of ...
    AnonymousAnonymous
    Oct 13, 2009 at 6:20 am
    Oct 22, 2013 at 11:17 am
  • As of today, I have found for me that ldap_search and ldap_list are reversed in functionality. ldap_list now searches the subtree and ldap_search does not. This is witnessed when searching against an ...
    RtdeesRtdees
    Oct 9, 2009 at 8:02 pm
    Oct 22, 2013 at 11:17 am
  • <?php // Substring without losing word meaning and // tiny words (length 3 by default) are included on the result. // "..." is added if result do not reach original string length function ...
    Info/a/nopticon/dot/comInfo/a/nopticon/dot/com
    Oct 8, 2009 at 6:41 pm
    Oct 22, 2013 at 11:17 am
  • build a basic html table from a csv file <style table { text-align: left; border-collapse: collapse; } tr:hover { background: blue; color: white } th, td { padding: 7px } </style <?php echo "<table ...
    Rt10kRt10k
    Oct 8, 2009 at 6:13 pm
    Oct 22, 2013 at 11:17 am
  • I tried this function to create safe SQL arrays when I'm creating query strings from keywords, but I found it to be too bulky for my purposes. So, instead I created this function: <?php //Create a ...
    ZigbigidorluZigbigidorlu
    Oct 6, 2009 at 5:35 pm
    Oct 22, 2013 at 11:17 am
  • Another version of a stopwatch-style function, this one with the following features: - Can evaluate any function (callback) with any arbitrary arguments - Can specify the # of iterations to run The ...
    Strata_rangerStrata_ranger
    Oct 1, 2009 at 6:32 pm
    Oct 22, 2013 at 11:17 am
  • It seems that as of PHP 5.3, the link_identifier parameter is no longer optional. If not included, it would cause the script to crash with no errors in the output. ---- Server IP: 69.147.83.197 ...
    NospampleaseNospamplease
    Oct 11, 2009 at 8:58 am
    Oct 22, 2013 at 8:45 am
  • Child class of DOMDocument which has a toArray() method. Enjoy and/or improve <?php class MyDOMDocument extends DOMDocument { public function toArray(DOMNode $oDomNode = null) { // return empty array ...
    YargdahcYargdahc
    Oct 5, 2009 at 11:58 pm
    Oct 22, 2013 at 8:45 am
  • When used with RSA, this function only accepts a single block. Block size is equal to the RSA key size - i. e., with a 1024-bit key, block size should be 128 bytes. Depending on the padding scheme, ...
    SevaaSevaa
    Oct 3, 2009 at 1:57 am
    Oct 22, 2013 at 8:45 am
  • As a pertinent note, there's an issue with this function where parsing any string longer than 94326 characters long will silently return null. So be careful where you use it at. ---- Server IP: ...
    NatedubyaatnospamdotgmaildotcomNatedubyaatnospamdotgmaildotcom
    Oct 2, 2009 at 3:58 pm
    Oct 22, 2013 at 8:45 am
  • if you are using the preg_replace with arrays, the replacements will apply as subject for the patterns later in the array. This means replaced values can be replaced again. Example: <?php $text = 'We ...
    InfoInfo
    Oct 2, 2009 at 2:38 am
    Oct 22, 2013 at 8:45 am
  • -better to use the php methode 'getenv()' to access the enviroment vars -the original 'sys_get_temp_dir()' don't use realpath, than it's better to make 'realpath(sys_get_temp_dir())' <?php if ( ...
    Phpatktools EuPhpatktools Eu
    Oct 17, 2009 at 6:18 am
    Jul 23, 2013 at 1:50 pm
  • I pulled my hair off for hours trying to get rid of strange backslashes in my incoming JSON-data in POST-pool, making it impossible to decode the incoming JSON-data. For those of you facing the same ...
    BennyBenny
    Oct 16, 2009 at 9:24 am
    Jun 14, 2013 at 10:04 am
  • To avoid data loss (problem with '\r\n') you can convert string to array and serialize an array. Example: <?php //Store data: $array = explode('\r\n', $string); $serialized = serialize($array); ...
    VladsavitskyVladsavitsky
    Oct 21, 2009 at 4:46 pm
    Nov 6, 2012 at 1:37 am
  • Using NodeLists to store results of an XQuery is not very functional if you are planning to do some operations with those Nodes. Instead, you can use an array in this way: <?php $nodelist = $xpath- ...
    A Lepedev+phpA Lepedev+php
    Oct 2, 2009 at 5:43 am
    Oct 16, 2012 at 12:54 am
  • Below a.lepe says, "Using NodeLists to store results of an XQuery..." To clarify, this should say, "...the results of an XPath query...". XQuery contains XPath but has additional functionality such ...
    WaltWalt
    Oct 16, 2009 at 4:42 pm
    Oct 16, 2012 at 12:54 am
  • To take full advantages of all array features with ArrayAccess, then you would need to implements Countable and Iterator Like this. <?php class ArrayOfColorModel implements ArrayAccess, Iterator, ...
    CintixCintix
    Oct 29, 2009 at 9:20 am
    Oct 10, 2012 at 1:32 am
  • It is possible to mark objects with unique identity to establish required functionality: <?php if (!function_exists('spl_object_hash')) { function spl_object_hash($object) { if (!is_object($object)) ...
    TestuserTestuser
    Oct 14, 2009 at 12:04 pm
    Oct 8, 2012 at 4:11 am
  • I couldn't find any correct date differentiate function anywhere so I wrote this one which works correctly. It's fully resistant to all troubles with different day count of the month or leap year. ...
    DavixDavix
    Oct 6, 2009 at 7:28 pm
    Sep 7, 2012 at 1:37 am
  • Another example that might help. <?php (isset($panelemail) && !empty($panelemail) ? $panelemail : $userdata['email']); ? returns the userdata email address, but this <?php (isset($panelemail) AND ...
    RobRob
    Oct 23, 2009 at 5:04 pm
    Aug 2, 2012 at 3:15 pm
Group Navigation
period‹ prev | Oct 2009 | next ›
Group Overview
groupphp-notes @
categoriesphp
discussions586
posts1,113
users450
websitephp.net

450 users for October 2009

Daniel Brown: 312 posts Sixd: 115 posts Thiago: 80 posts Philip: 49 posts Anonymous: 49 posts : 13 posts Phpdoc: 4 posts Lgb: 4 posts Rarioj: 4 posts Iimdotvxkatgmaildotcom: 3 posts Sisi_hagen: 3 posts Tiffany: 3 posts Jgfo85: 3 posts Gmorris: 3 posts Kapoor_rajiv: 3 posts Rymo: 2 posts Mikhail V Gavrilov: 2 posts Edwin H: 2 posts Guy Paddockatgmaildotcom: 2 posts Zoe: 2 posts
show more
Archives