FAQ

Search Discussions

585 discussions - 986 posts

  • Regardings the post of g dot vieri AT gmail dot com: It's actually the precedence that causes this effect: <?php $res = $a || $b; # is the same as $res = ($a || $b); ? $a is true in this case, hence ...
    /life/life
    Apr 20, 2007 at 3:35 pm
    May 1, 2007 at 5:39 am
  • NEVER USE IN CYCLES! //size of $arr ~ 2000 elements //wrong variant (Time exec ~ 19 sec) for($i=0;$i<count($arr);$i++) { ... } //right variant(Time exec ~ 0.2 sec) $arr_size=count($arr); ...
    YarolanYarolan
    Apr 26, 2007 at 11:50 am
    Jan 14, 2013 at 1:11 pm
  • One simple way to write out nicely indented XML data is by converting the whole batch to a DOM document, and using its formatOutput option: $doc = new DOMDocument('1.0'); $doc- formatOutput = true; ...
    EggbirdEggbird
    Apr 8, 2007 at 8:34 pm
    Jan 28, 2011 at 2:23 pm
  • An updated version of webcreators script that fixes a notice error about an undefined index and removes blank array value. function my_array_unique($from) { for ($i=count($from)-1;$i 1;$i--) { $last ...
    DannyDanny
    Apr 13, 2007 at 1:41 am
    Jan 23, 2011 at 5:13 pm
  • I had a problem loading php_oci8.dll with php 5.2, Apache, and windows XP - a module not loaded error, on every apache restart. I eventually found that I had to add the oracle instantclient library ...
    David ReynoldsatDavid Reynoldsat
    Apr 10, 2007 at 2:52 pm
    Jun 26, 2009 at 6:38 pm
  • I found Craig's code useful, but wanted the ability to limit the granularity to only show most significant time periods. there's the bit i adapted: <? function ago ( $epoch, $max_phrases=null ) { ...
    Gregatmix Lycos ComGregatmix Lycos Com
    Apr 24, 2007 at 7:41 pm
    Apr 15, 2009 at 3:59 pm
  • A very useful function for creating key with a lot of flexibility to control the type of characters used in your key you can add your custom type of character limitations to it by adding a custom ...
    DxillusionDxillusion
    Apr 12, 2007 at 5:45 pm
    Dec 30, 2007 at 6:44 pm
  • Darn, my previous message apparently didn't make it to the server although I got no error message. O.K., here's the entire updated, corrected version. Please delete any other messeges from me in this ...
    MarkschmidMarkschmid
    Apr 16, 2007 at 10:13 pm
    Jun 18, 2007 at 8:03 pm
  • Here's a somewhat more efficient way to truncate a string at the end of a word. This will end the string on the last dot or last space, whichever is closer to the cut off point. In some cases, a full ...
    RichdeesonRichdeeson
    Apr 26, 2007 at 3:53 pm
    Jul 22, 2014 at 3:29 am
  • A modernized version of the flatten_array() functies written by davidj at boundlessgallery dot DISLIKESPAM dot com on 02-Apr-2004 03:10 This function is able to work with associative arrays <?php ...
    InfoInfo
    Apr 17, 2007 at 8:08 pm
    May 6, 2014 at 10:01 pm
  • When using loadHTML() to process UTF-8 pages, you may meet the problem that the output of dom functions are not like the input. For example, if you want to get "Cạnh tranh", you will receive ...
    HanhvansuHanhvansu
    Apr 27, 2007 at 3:45 am
    Mar 24, 2014 at 3:41 pm
  • For a multifile upload try this: <?php foreach($_FILES as $file) { if($file['error'] == 0 && $file['size'] 0) { move_uploaded_file($file['tmp_name'], $targetdir.$file['name']); } } ? ---- Server IP: ...
    Abuse BernhardkrollAbuse Bernhardkroll
    Apr 6, 2007 at 1:04 am
    Feb 26, 2014 at 12:05 am
  • Here is a modification to the note below: function check_email($email) { if(preg_match('/^\w[-.\w]*@(\w[-._\w]*\.[a-zA-Z]{2,}.*)$/', $email, $matches)) { if(function_exists('checkdnsrr')) { ...
    ReportingsjrReportingsjr
    Apr 28, 2007 at 1:00 am
    Oct 22, 2013 at 6:44 am
  • A simple benchmark to check differents about : - simple and double quote concatenation and - double quote and heredoc replacement <?php function test_simple_quote_concat() { $b = 'string'; $a = ' ...
    PhpatmoechofedotcomPhpatmoechofedotcom
    Apr 1, 2007 at 3:39 pm
    Jun 25, 2013 at 9:25 pm
  • The PHPSerialization class linked in my last comment now supports serialize()'ing java objects to the php serialization text format, thus facilitating a means of data inter-change between php and ...
    KrisdoverKrisdover
    Apr 22, 2007 at 12:40 am
    Nov 6, 2012 at 2:11 am
  • A note to the last person. To avoid the incomplete class notice, all you need to do is make sure you include the class definition before session_start(); is called. Simple as that. ---- Server IP: ...
    MeMe
    Apr 10, 2007 at 3:44 pm
    Nov 6, 2012 at 1:31 am
  • Thank you, thank you, thank you to Chris Hayes for $_SESSION['my_object'] = unserialize(serialize($_SESSION['my_object'])) I wrestled through several very learned articles that dealt with creating ...
    ElisevanlooijElisevanlooij
    Apr 7, 2007 at 9:10 am
    Nov 6, 2012 at 1:30 am
  • A more detailed explanation of the string incremant is: First of all it is checked wether the string is a standart representaion of a number wich is true if it equals the regex /^ ...
    Q1712Q1712
    Apr 21, 2007 at 1:47 am
    Aug 2, 2012 at 3:22 pm
  • "It *explicitly* says in the documentation that the division operator *always* returns a float value *regardless* of the types of the operands." Documentation is not always right. See ...
    TchanTchan
    Apr 25, 2007 at 8:05 pm
    Aug 2, 2012 at 3:06 pm
  • Be careful if you're assuming that arg_separator defaults to "&". For me, with my xampp installation and PHP 5.2.1, this was scary: [php.ini] ; The separator used in PHP generated URLs to separate ...
    PinkgothicPinkgothic
    Apr 27, 2007 at 9:19 am
    Aug 2, 2012 at 1:37 pm
  • I found out that you can use php:s crypt function to change the user/root password in Linux distributions (at least in Slackware). You just have to change the encrypted password for the user in the ...
    JouJou
    Apr 6, 2007 at 8:48 am
    Aug 1, 2012 at 1:26 am
  • for me(on OpenBSD4.0+Apache 1.3(standard)+php4.3.10) blowfish seems to work if you do something like this: if (CRYPT_BLOWFISH == 1) { $salt="this should really be a long line of salt"; $blowfish_salt ...
    LethLeth
    Apr 6, 2007 at 2:47 pm
    May 19, 2012 at 8:40 pm
  • As rosswilliams mentioned; The example breaking in and out of the PHP tags doesn't "work as expected". The manual and some comments mention that PHP "simply starts outputting whatever it finds..." ...
    MadmanMadman
    Apr 18, 2007 at 3:40 am
    Mar 14, 2012 at 6:51 pm
  • as an alternative for marcini's note: just clear the statement variable before you issue another query: <?php $stmt = $db- prepare('SELECT * FROM test'); // fetch only the first row $row = $stmt- ...
    RedcubeRedcube
    Apr 5, 2007 at 9:49 am
    Jun 21, 2011 at 3:06 pm
  • Regarding the two previous notes - I downloaded the "latest CVS" a week ago for Windows and was surprised to notice that this issue is gone there, ie you don't have to close cursor before doing next ...
    DennisDennis
    Apr 7, 2007 at 1:14 pm
    Jun 21, 2011 at 3:06 pm
  • For anyone looking for a way to import PHP serialized variables into java as java Objects; I have written a simple class to unserialize strings containing PHP serialized variables. It makes the ...
    KrisdoverKrisdover
    Apr 11, 2007 at 9:06 pm
    Jun 20, 2011 at 3:23 pm
  • BenBE's function is broken for testing objects. Here's a variation on it just for testing objects: <?php function same_obj(&$var1, &$var2) { if ($var1 !== $var2) { return false; } $same = false; $key ...
    SteveclaySteveclay
    Apr 6, 2007 at 1:20 pm
    Feb 8, 2011 at 12:36 pm
  • <?php // class __partial { var $args; var $fn; function __partial($args) { $this- fn = array_shift ($args); $this- args = $args; } function right() { $args = func_get_args (); array_splice ($args, ...
    LiteLite
    Apr 28, 2007 at 11:04 am
    Jan 23, 2011 at 4:17 pm
  • Indeed, as stated by David, since integers are stored on multiple bytes in the memory in binary format, once an signed long integer reaches the maximum value of 2147483646 (which is the maximum value ...
    AryelAryel
    Apr 26, 2007 at 5:37 pm
    Sep 16, 2010 at 3:07 pm
  • I'm sorry to say that the posted convertIntToAlphabet function does not work correctly. It fails on numbers with a "Z" in it! Aside that it also gives a PHP warning, I really did not like recursion ...
    VdklahVdklah
    Apr 27, 2007 at 8:56 am
    Sep 15, 2010 at 9:05 pm
  • Ok, all looks like, but what to do if you use another encoding with urldecode? Here is my solution - I have towork with project in windows-1251 encoding $textu = Misc_func::getRequestParam('text', ...
    Brainstorm brainstorm . nameBrainstorm brainstorm . name
    Apr 12, 2007 at 11:28 am
    Aug 13, 2010 at 3:29 pm
  • I believe the example for array_shift is incorrect. The print_r has the wrong variable. -NF ---- Server IP: 69.147.83.197 Probable Submitter: 207.164.141.163 ---- Manual Page -- ...
    Nando_fNando_f
    Apr 27, 2007 at 3:37 pm
    Apr 7, 2010 at 7:08 pm
  • Another email validator with SMTP verification, based on Poot's one, with live demo: http://www.tienhuis.nl/php-email-address-validation-with-verify-probe ---- Server IP: 194.109.193.76 Probable ...
    DickDick
    Apr 17, 2007 at 12:12 pm
    Apr 7, 2010 at 6:08 pm
  • If you are looking for a comprehensive visual list of entities check here: http://www.w3schools.com/tags/ref_entities.asp ---- Server IP: 216.194.113.175 Probable Submitter: 70.162.112.18 ---- Manual ...
    GhoffmanGhoffman
    Apr 4, 2007 at 6:13 am
    Apr 7, 2010 at 4:37 pm
  • Here is an example of another XML parsing script that parses the document into an array/object structure instead of relying on startElement, endElement, etc handlers. You can find the documentation ...
    AdamaflynnAdamaflynn
    Apr 14, 2007 at 6:45 pm
    Mar 3, 2010 at 6:38 pm
  • In Addition to the hint according error_reporting and display_errors in case that there is a global restriction that prevents showing the errors. I tried the example of "petrov dot michael () gmail ...
    TswaeschTswaesch
    Apr 12, 2007 at 12:47 pm
    Feb 18, 2010 at 2:20 pm
  • An improvement on ashus at atlas dot cz's script below would be to add around the script that generates the output: <?php //... ob_start (); // script goes here $out = ob_get_content(); ob_end_clean ...
    JphpJphp
    Apr 4, 2007 at 2:32 pm
    Feb 18, 2010 at 2:09 pm
  • FreeTDS is work!!! But after install you shoul add in config file 1. Add in freetds.conf client cahrset: [TDS_NAME_TO_CONNECT] host = 192.168.0.1 port = 1433 tds version = 8.0 client charset = CP1251 ...
    DeyuraDeyura
    Apr 10, 2007 at 10:00 am
    May 18, 2009 at 2:04 am
  • If your having problems with your script at random times refusing to connect to the database. Try editing php.ini and uncommenting this line. mssql.max_procs = -1 This solved the problem for me after ...
    VbchrisVbchris
    Apr 6, 2007 at 3:52 pm
    May 18, 2009 at 2:03 am
  • My previous post although seemed to solve the problem of the connection randomly refusing to connect, it didn't. This however did. I created a loop to create a few connections and noticed it was ...
    VbchrisVbchris
    Apr 24, 2007 at 8:17 am
    May 18, 2009 at 2:03 am
  • The bug fix in my last post. During test I have discovered that if you have locked file for writing (LOCK_EX) both read and write will not be accessible from other scripts. In case of read locking ...
    AdministratorAdministrator
    Apr 30, 2007 at 12:50 am
    May 18, 2009 at 12:31 am
  • Hello, I want to give an example how to lock file with two or more flags (for example reading and writing). IMPORTANT: each locking should be done separately, the correct way of using flock() is: ...
    AdministratorAdministrator
    Apr 30, 2007 at 12:24 am
    May 18, 2009 at 12:31 am
  • i tried out 3 different scripts, and played with them for a few hours. Ugh. Max Howell's mxcl mail function worked right off the bat - attachments, and body. using RH + php 4.4. thanks max! ---- ...
    MarkMark
    Apr 6, 2007 at 3:50 pm
    May 17, 2009 at 8:04 pm
  • i strongly feel that internet site developers should exclusively use UTF-8 text encoding / character setting over ISO-8859-1... UTF-8 is universal and will display all characters as they were meant ...
    GeoffmontrealGeoffmontreal
    Apr 30, 2007 at 4:24 pm
    May 17, 2009 at 8:04 pm
  • I find the documentation mildly misleading: fgetcsv() does not - as this documentation seemingly claims in the descriptive line - get a line out of the file (via the file pointer) and then parses ...
    PinkgothicPinkgothic
    Apr 3, 2007 at 1:42 pm
    May 17, 2009 at 6:07 pm
  • Thank you to the mystery contributor of csv_string_to_array function: http://uk3.php.net/manual/en/function.fgetcsv.php#62524 This works great when your CSV data has literal commas inside enclosures ...
    BobBob
    Apr 29, 2007 at 11:14 am
    May 17, 2009 at 6:06 pm
  • The timeout is tricky as far as I read it depends on the time synchronization between the server and the client. If the GMT time is different (for example your computer is 5 min forward from the ...
    WernightWernight
    Apr 20, 2007 at 8:29 am
    May 17, 2009 at 5:46 pm
  • this function returns the text between 2 strings: function get_between ($text, $s1, $s2) { $mid_url = ""; $pos_s = strpos($text,$s1); $pos_e = strpos($text,$s2); for ( $i=$pos_s+strlen($s1) ; ( ( $i ...
    Gal_chen123Gal_chen123
    Apr 3, 2007 at 4:53 pm
    May 17, 2009 at 4:27 pm
  • Thanks to spinicrus (see above) I have sorted out a problem that was bugging me for ages. I have a routine in Etomite Content Management System that will display a set number of characters of a news ...
    Php-generalPhp-general
    Apr 14, 2007 at 2:13 pm
    May 17, 2009 at 4:27 pm
  • In response to maxteiber at gmail dot com, regarding rounding 141.075 to 2 decimal places: I can justify your computer for rounding it to 141.07. It's following a rounding rule similar to the ...
    PjmatpehjotadotcomPjmatpehjotadotcom
    Apr 27, 2007 at 11:56 pm
    May 17, 2009 at 4:13 pm
Group Navigation
period‹ prev | Apr 2007 | next ›
Group Overview
groupphp-notes @
categoriesphp
discussions585
posts986
users483
websitephp.net

483 users for April 2007

Bjori: 108 posts Tularis: 93 posts Colder: 88 posts Nlopess: 42 posts Php-general: 36 posts : 33 posts Derick: 22 posts Philip: 19 posts Bobby: 11 posts Mazzanet: 10 posts Q1712: 10 posts Vincent: 8 posts Phpdoc: 5 posts Jason: 4 posts Legolas558d0tusersdotsfdotnet: 4 posts Pinkgothic: 4 posts Earlsinclair2001: 4 posts Robert: 3 posts Deyura: 3 posts Richard: 3 posts
show more
Archives