FAQ

Search Discussions

542 discussions - 1,149 posts

  • If you use implode() with the return value by mysql_fetch_array, if you use MYSQL_BOTH on parameter 2, the result is not really what you're expecting. For example : my sql database contains "Amine, ...
    AmineoAmineo
    Jan 21, 2011 at 3:40 pm
    Jan 21, 2011 at 4:52 pm
  • Here is my fsockopen-based HTTP request fonction (GET and POST) : function http_request( $verb = 'GET', /* HTTP Request Method (GET and POST supported) */ $ip, /* Target IP/Hostname */ $port = 80, /* ...
    JeremysaintotJeremysaintot
    Jan 15, 2011 at 12:16 am
    Jan 12, 2012 at 4:58 pm
  • There are many scripts/functions to convert a Hex string to a Floating point number, but i could'nt find any usable function to convert a float2hex (float number to hexadecimal) .. so i went on an ...
    InfoInfo
    Jan 28, 2011 at 10:47 am
    Feb 2, 2013 at 3:11 pm
  • I've written this function so many times, but every time I find a new problem - this one is working in all browsers. function downloadFile( $fullPath ){ // Must be fresh start if( headers_sent() ) ...
    PhpnetPhpnet
    Jan 31, 2011 at 8:51 pm
    Apr 4, 2014 at 11:23 am
  • if you want $n % $m = 0 and $n % $m == ($n + $m) % $m to hold everywhere except for overflows: <?php function modulo($n, $m) { $r = $n % $m; return $r < 0 ? $r + abs($m) : $r; // replace abs($m) with ...
    WaltertrossWaltertross
    Jan 31, 2011 at 2:06 pm
    Aug 2, 2012 at 3:08 pm
  • Hello all, May I pos my firs function as novice in php here . This funtion count all characters in a strign without spaces , so only chars, no spaces . function countchar ($string) { $result = strlen ...
    Canschi SergiuCanschi Sergiu
    Jan 8, 2011 at 9:43 am
    Aug 2, 2012 at 12:17 pm
  • After numerous hours of trying to actually receive a hexadecimal digit from dechex, I decided to give it a go myself. I kept trying to do bitwise comparisons on the result however I was comparing ...
    RodRod
    Jan 13, 2011 at 12:42 pm
    Jun 13, 2012 at 3:22 pm
  • Here is a good encryption function im building for my custom CMS and decided to share with the community function eliteEncrypt($string) { // Create a salt $salt = md5($string."%*4!#$;\.k~'(_@"); // ...
    Harrisjason10Harrisjason10
    Jan 6, 2011 at 10:19 am
    Jul 17, 2011 at 8:35 am
  • I did some performance testing on using sprintf() and perhaps just doing some variable passing. Perhaps someone else my find this useful as well. This was the loop of code that I tested with ...
    JustingiesbrechtJustingiesbrecht
    Jan 22, 2011 at 9:17 pm
    Apr 6, 2011 at 1:29 pm
  • Here's a function which returns an array of all user defined global variables: function globals() { $globals = $GLOBALS; foreach (array( 'GLOBALS', '_ENV', 'HTTP_ENV_VARS', '_POST', 'HTTP_POST_VARS', ...
    QubsoftQubsoft
    Jan 22, 2011 at 7:37 pm
    Mar 5, 2011 at 9:36 am
  • Second function (HEX2FLOAT32n) converts Hexadecimal 8 digit strings to fixed decimals float numbers. (complementary to FLOAT2HEX32n above) <? /** Complementary functions to CONVERT PHP FLOATING POINT ...
    InfoInfo
    Jan 28, 2011 at 10:39 am
    Jan 28, 2011 at 1:01 pm
  • Unfortunately there is still no useful output format to handle redirects. This function will bring all non-broken headers into a usable format. Too bad it has to call the get_headers() funtion 2 ...
    LukasnajdukLukasnajduk
    Jan 11, 2011 at 11:28 am
    Jan 25, 2011 at 10:17 pm
  • The function below is missing a bugfix. The fix is there in the code to replace (thanks, editor!), but the function itself doesn't have it. The line: $i += $ncount; should be: $i += $ncount - 1; ---- ...
    SyrgjynSyrgjyn
    Jan 19, 2011 at 9:57 pm
    Jan 19, 2011 at 10:03 pm
  • Recently I had to get all locations of a one-dimensional non-associative array (needle, not array of needles) in another one-dimensional non-associative array (haystack) without using more memory ...
    SyrgjynSyrgjyn
    Jan 19, 2011 at 3:42 am
    Jan 19, 2011 at 10:00 pm
  • Here is how I solved the problem of missing date_diff function with php versions below 5.3.0 The function accepts two dates in string format (recognized by strtotime() hopefully), and returns the ...
    KshegunovKshegunov
    Jan 10, 2011 at 5:18 pm
    Jan 11, 2011 at 3:32 pm
  • strtotime('last day of this year') doesn't work because last day of is only for month use strtotime('-1 day', strtotime('first day of next year')) or anything else ---- Server IP: 69.147.83.197 ...
    TripolliteTripollite
    Jan 4, 2011 at 11:50 pm
    Apr 28, 2014 at 3:08 pm
  • I see a couple of notes where multiple Content-Type headers are sent. Don't do that. RFC2616 only presents two scenarios for multiple Content-Type headers in a response: 1. a "300 Multiple Choice" ...
    AnthonAnthon
    Jan 3, 2011 at 4:16 pm
    Apr 4, 2014 at 11:23 am
  • <?php function avrg() { $count = func_num_args(); $args = func_get_args(); return (array_sum($args) / $count); } ? This function calculates average of numbers given as arguments. Examples: avrg(100, ...
    UheheshUhehesh
    Jan 7, 2011 at 10:13 am
    Mar 18, 2014 at 7:43 pm
  • installing using pecl: # pecl install oauth may need to install pcre headers (debian based) # apt-get install libpcre3-dev ---- Server IP: 69.147.83.197 Probable Submitter: 71.186.139.139 ---- Manual ...
    Matthew GeneralMatthew General
    Jan 16, 2011 at 3:39 am
    Oct 22, 2013 at 12:18 pm
  • Simple php client and server: Client: <?php // bind SOAP/Client.php - path of the php file require_once "SOAP/Client.php"; // URI delivered to web service $sc = new ...
    JeffmixputeJeffmixpute
    Jan 24, 2011 at 11:06 pm
    Oct 22, 2013 at 12:16 pm
  • Very important to note is that copy() handles url wrappers, but sometimes incorrectly. For example, you can copy a file like <?php copy("http://example.net/file.dat","./local_file.dat"); ? However, ...
    TomasTomas
    Jan 21, 2011 at 12:00 pm
    Oct 22, 2013 at 6:50 am
  • On Gentoo you need to have spl USE flag set. ---- Server IP: 69.147.83.197 Probable Submitter: 81.19.123.230 ---- Manual Page -- http://www.php.net/manual/en/spl.installation.php Edit -- ...
    JarnoJarno
    Jan 18, 2011 at 10:49 am
    Jul 8, 2013 at 12:46 am
  • Note : get_defined_functions return lowercase names on Windows 7 with WampServer 2.1 ---- Server IP: 69.147.83.197 Probable Submitter: 82.66.51.218 ---- Manual Page -- ...
    GmdebbyGmdebby
    Jan 14, 2011 at 9:20 am
    Mar 22, 2013 at 3:16 pm
  • Function that determines a file's size only with PHP functions, for all files, also those 4 GB: <?php function fsize($file) { // filesize will only return the lower 32 bits of // the file's size! ...
    Arne_elsterArne_elster
    Jan 28, 2011 at 2:18 pm
    Jan 22, 2013 at 12:20 am
  • For those that need to know the default of $maxLen, it's defined in the php source code as PHP_STREAM_COPY_ALL, and because that is not available to us mere mortal users, that constant is defined as ...
    John_schlickJohn_schlick
    Jan 27, 2011 at 8:15 pm
    Jan 19, 2013 at 3:46 am
  • If you use RecursiveDirectoryIterator with RecursiveIteratorIterator and run into UnexpectedValueException you may use this little hack to ignore those directories, such as lost+found on linux. <?php ...
    AntennenAntennen
    Jan 2, 2011 at 5:32 pm
    Dec 19, 2012 at 1:19 am
  • IMO, the function should allow you to remove any tag that you specify. The structure could be something like this: strip_tags($string,$allow_or_remove_listed,$list) As an example: <?php $str = "<p ...
    MontanaMontana
    Jan 31, 2011 at 6:37 pm
    Sep 20, 2012 at 12:14 pm
  • Complexity of count function. I just tested the complexity of count(). It looks O(1). Here is the result. << counting array with 1 element total time : 0.021ms start - end : 100 % << counting array ...
    ProPro
    Jan 15, 2011 at 10:28 pm
    Sep 17, 2012 at 12:08 am
  • Variables declared as global inside a function are available outside the function. <?php function writefunctionvars() { global $foo; $foo = "something"; } writefunctionvars(); echo $foo; // displays ...
    BbraunBbraun
    Jan 12, 2011 at 11:35 am
    Sep 5, 2012 at 2:13 am
  • SQLite3::escapeString() should be used on every piece of user input before constructing the query string, or *after* constructing the query string? Calling this function on user input BEFORE ...
    ReblesRebles
    Jan 16, 2011 at 6:16 pm
    Sep 3, 2012 at 9:05 am
  • driver version 1.0.11 method immortal() seems just do not functioning use timeout(-1) instead ---- Server IP: 69.147.83.197 Probable Submitter: 91.206.146.60 ---- Manual Page -- ...
    BlablaBlabla
    Jan 27, 2011 at 9:59 am
    Sep 2, 2012 at 12:37 pm
  • Getting php-cgi to work as CGI in my home-grown HTTP server took some experimentation. (The error messages were not helpful, to put it mildly. And a lot of web searches returned results about how to ...
    Forrest-phpForrest-php
    Jan 26, 2011 at 2:51 pm
    Dec 28, 2011 at 8:55 am
  • date.timezone = "Europe/Berlin" #Berlin center district near "Neptunbrunnen" date.default_latitude = 52.5194 date.default_longitude = 13.4067 ---- Server IP: 85.214.154.209 Probable Submitter: ...
    NowakatairconomydandotcomNowakatairconomydandotcom
    Jan 11, 2011 at 8:27 am
    Aug 28, 2011 at 6:15 pm
  • it won't work if fatal error occur ---- Server IP: 69.147.83.197 Probable Submitter: 122.166.42.191 ---- Manual Page -- http://www.php.net/manual/en/function.error-get-last.php Edit -- ...
    JerilkcJerilkc
    Jan 27, 2011 at 6:20 am
    Jul 14, 2011 at 10:37 pm
  • Here is something I use all the time. It save on typing and adding extra if..else blocks to my code. Basically, you use the function in a specific if statement to determine if there are any records ...
    Jack ThomsonJack Thomson
    Jan 2, 2011 at 6:20 pm
    Jul 10, 2011 at 10:23 pm
  • Use this code, it will help you find the appropriate variable: <?php echo '<table border="1" '; foreach ($_SERVER as $k = $v){ echo "<tr <td " . $k ."</td <td " . $v . "</td </tr "; } echo "</table " ...
    MehradmahmoudianMehradmahmoudian
    Jan 31, 2011 at 7:23 am
    Jun 9, 2011 at 1:06 pm
  • It doesn't to work with PHP-FPM, when using FastCgiExternalServer. ---- Server IP: 69.147.83.197 Probable Submitter: 82.35.198.141 ---- Manual Page -- ...
    StickmanStickman
    Jan 5, 2011 at 1:42 am
    Mar 25, 2011 at 3:41 am
  • You can also supress the warning messages from displaying by prefixing the statement with the '@' symbol, as: @$doc- loadHTML($String); ---- Server IP: 69.147.83.197 Probable Submitter: 98.84.126.39 ...
    DavidpooleDavidpoole
    Jan 24, 2011 at 1:03 am
    Feb 17, 2011 at 3:41 pm
  • Require is a really neat function, compared to include. You can use it for security purposes. For example, consider that you have a database that's based on simple text-files. Theoretically, someone ...
    HoldoffhungerHoldoffhunger
    Jan 3, 2011 at 8:21 pm
    Feb 14, 2011 at 9:44 am
  • I found that DateTime::diff isn't as accurate as I thought. I calculated the age gap between now and a birthdate from before 1970 (unix epoch). Here's what I got: Given today is January 21st, 2011: ...
    SchindhelmSchindhelm
    Jan 21, 2011 at 8:39 pm
    Feb 1, 2011 at 5:30 pm
  • Why does this function even exist? Hackers use this function in the following function to open up php to more attacks. I found the below inside a virus file on one of my servers: ...
    EliEli
    Jan 20, 2011 at 1:49 am
    Feb 1, 2011 at 1:54 pm
  • Hello coders, i want to put session on my site url because someone copying my link & paste it their websites. how i can prevent this by using php sessions ?? i hope someone can help me ---- Server ...
    Cuteamit456Cuteamit456
    Jan 31, 2011 at 5:39 pm
    Jan 31, 2011 at 5:43 pm
  • Is there a way of exporting a specific revision? ---- Server IP: 69.147.83.197 Probable Submitter: 217.91.146.41 ---- Manual Page -- http://www.php.net/manual/en/function.svn-export.php Edit -- ...
    PowtacPowtac
    Jan 31, 2011 at 3:29 pm
    Jan 31, 2011 at 3:30 pm
  • Hola, en primer lugar gracias por ayudar, en segundo lugar decir que soy nuevo en php y me he involucrado en un proyecto el cual necesita de manejos de carpetas y archivos, di con esta manera de ...
    DavitociberDavitociber
    Jan 31, 2011 at 3:04 pm
    Jan 31, 2011 at 3:04 pm
  • There is a quirk to be aware of regarding use of echo. If you have a command which you want to execute which takes input from STDIN, you would normally do: <?php $output = shell_exec("echo $input | ...
    NicholasNicholas
    Jan 30, 2011 at 3:32 am
    Jan 31, 2011 at 1:35 pm
  • Quick note regarding a theory above... Yes, very good point to make about the math, however its not an odd thing. Look closer at the logic involved. $n = 3; $a = $n * --$n; Not 6 but 4? Yes, but not ...
    CoryCory
    Jan 30, 2011 at 6:55 am
    Jan 31, 2011 at 1:35 pm
  • Actually, @moechofe, you can use callable members inside another class, by applying the following technique: <?php class CallableClass { function __invoke( $x ) { var_dump( $x ); return $this; } ...
    Mpotra ComMpotra Com
    Jan 31, 2011 at 5:30 am
    Jan 31, 2011 at 1:34 pm
  • plz plz can any 1 decrypt this red string 32 characterz????? f4012f3d4e531750249623f325cf0d89 plz convert this and mail me @ hasan_asgher5@yahoo.com plz plz plz ---- Server IP: 69.147.83.197 Probable ...
    Hasan_asgher5Hasan_asgher5
    Jan 31, 2011 at 9:54 am
    Jan 31, 2011 at 1:34 pm
  • This is a correction to the last post. I meant to include relative parent directory reference but omitted it in the PHP code. It should have been like this: <?php include "../Info/Variables.php"; ...
    ItsolsItsols
    Jan 31, 2011 at 12:10 pm
    Jan 31, 2011 at 1:34 pm
  • When making multiple includes (i.e., including a file from one location,and that file includes another). Here's an example. Assume your paths are like this: File1: www/MyProject/main.php <?php ...
    ItsolsItsols
    Jan 31, 2011 at 6:18 am
    Jan 31, 2011 at 1:34 pm
Group Navigation
period‹ prev | Jan 2011 | next ›
Group Overview
groupphp-notes @
categoriesphp
discussions542
posts1,149
users425
websitephp.net

425 users for January 2011

Danbrown: 597 posts Anonymous: 47 posts Thiago Pojda: 23 posts : 16 posts Jeffmixpute: 6 posts Phpdoc: 5 posts Tom: 5 posts Falkon303: 4 posts Akniep: 4 posts Daniel P. Brown: 4 posts Rakesh Mishra: 3 posts Chris Kistner: 3 posts O_shes01: 3 posts Akniep: 3 posts Tech: 3 posts Syrgjyn: 3 posts Ray Paseurgmail: 3 posts Meint: 2 posts Kirk Kerr: 2 posts Lukasnajduk: 2 posts
show more
Archives