Alphos :O Nothing!
GO [GO] Gross Overgeneralization. Everything that we tell you in ##PHP is what we consider "best practices". Of course, only YOU know your own requirements, so you may feel you need to do something we told you not to. Just don't say we didn't warn you.
IDE Questions about specific IDEs and IDE discussion in general usually degrades rapidly due to personal preference. It is not a valid topic for ##php.
IDEs Questions about specific IDEs and IDE discussion in general usually degrades rapidly due to personal preference. It is not a valid topic for ##php.
MRE Mastering Regular Expressions' the bible of regex http://www.oreilly.com/catalog/regex3/ Use this utility for learning/understanding/troubleshooting your RegEx --> http://www.weitz.de/regex-coach/, or http://txt2re.com/
PCRE vs DOM Do not use PCRE (or any other flavour of regular expressions) to parse HTML or XML. Not only will it add lots of overhead, but you also incur the risk of having a faulty regular expression that will not match exactly what you want. Using DOM is by far the best way to parse HTML. See http://php.net/DOM
PDO PDO is PHP Data Objects, a database API that has a unified interface for many databases. You can learn how to use PDO here: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers
TIAS [TIAS] Try It And See. If you want to know if or how something works, try it first. "Testing Is Absolutely Simple"
XY The X-Y problem is when you want to do X, but you don't know how. You think you can hack X if you can just do Y, but you don't know how to do Y either. You ask (us) for help with Y. We think Y is a strange problem to want to solve... So just ask us about X.
array_key_intersect array array_intersect_key(array arr1, array arr2 [, array ...]) - Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). Equivalent of array_intersect_assoc() but does not do compare of the data. - http://php.net/array_intersect_key
array_shuffle uffle(array array_arg) - Randomly shuffle the contents of an array - http://php.net/shuffle
ask If you have a question, please just *ask it*. And don't address specific people - ask the channel. If somebody knows, they'll answer. :) To get help more quickly, don't ask "can I ask a question," "can anyone help," or "does anybody use/know about foo". Be as specific as you can. Also, please don't /msg people without permission, and read the topic before you ask.
bad idea If it's a bad idea, don't suggest it: they will screw it up horribly and blame you (or more importantly us) for it.
bom The Byte Order Marker is an invisible Unicode character that some editors (mainly Notepad and Wordpad) insert at the start of a file. PHP will see this as content and this may cause problems, particularly if you want to set headers. To test if your file has a BOM, use `xxd -g 3 -l 3 $FILENAME | awk '{print $2}'`. The output will be 'efbbbf' if the BOM exists.
books If you're looking for a PHP book, you might consider this stackoverflow response: http://stackoverflow.com/questions/693827/can-anyone-recommend-a-php-book-that-follows-good-development-principles/725925#725925 - however, remember that ##PHP doesn't make any specific claims regarding any of these books.
bot I ain't no stinkin' bot. I am a finely tuned and hand crafted tool. Oh wait... I guess I am a bot (that you should not abuse).
clever "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." – Brian W. Kernighan
cyth template engine Looking to use or make a template engine? Check out cyth's example here: http://codeangel.org/articles/simple-php-template-engine.html
cyth templating engine Looking to use or make a template engine? Check out cyth's example here: http://codeangel.org/articles/simple-php-template-engine.html
data Why shouldn't you store binary data in an RDBMS? 1) The filesystem is faster and better at storing binary data; 2) You don't have to carry the blob data in a PHP process, saving CPU and memory; 3) If you seperate the webhost and the dbhost, moving blobs back and forth is going to be expensive in computation and bandwidth. (There's more: they just don't fit here.)
deal with it http://codeangel.org/wp-content/uploads/2012/08/deal_w_it.png
die void die ([ string $status ] ) || void die ( int $status ) - Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit() is called. http://php.net/die
display_errors http://php.net/errorfunc
editors Questions about specific editors and editor discussion in general usually degrades rapidly due to personal preference. It is not a valid topic for ##php. Please try http://en.wikipedia.org/wiki/List_of_text_editors and find your own preference.
empty bool empty ( mixed $var ) - Determine whether a variable is considered to be empty. http://php.net/empty
english ##PHP is an English only channel. If you need support in some other language, please try elsewhere.
enter Don't use the enter key as punctuation. Think in complete thoughts, then type.
error An error? What kind of error? What does it say? Level of error, type of error, error message, filename, line of code, all of those give very interesting and accurate information as to where the error comes from in your code. And if you know where it comes from, you're half way to solving it! See also /msg php-bot error reporting
error reporting Set 'error_reporting' to -1 and 'display_errors' to 1 in your php.ini and be sure to restart your webserver/fastcgi-listeners. This is more reliable than using ini_set() and error_reporting() in the script, which will fail if there are parse errors. See http://php.net/errorfunc.configuration for more.
eval If eval() is the answer, you're almost certainly asking the wrong question. -- Rasmus Lerdorf, BDFL of PHP
explain yourself < bob2> i love how people can't even use "I'm embarassed to explain it to strangers" as a heuristic for whether something is a good idea
fad Function Array Dereferencing: In PHP 5.4+, you can dereference arrays returned from functions directly: that is, function()[0] works. PHP <= 5.3.x don't support this, so you need to use a temporary variable instead: $a = function(); $a[0].
for for (expr1; expr2; expr3) { ... } - Evaluates expr1, runs the loop if expr2 is true, then evaluates expr3 before re-testing expr2 - http://php.net/for
for you t to hash passwords? Use PHP's new password hashing API: http://php.net/password (native on PHP 5.5; available at https://github.com/ircmaxell/password_compat for PHP 5.3.7+). If you're stuck on an older version of PHP 5.3, use crypt(): http://php.ss23.geek.nz/2011/01/12/Using-crypt.html. On older versions of PHP still? It might be time to upgrade!
foreach foreach (array_expression as $value) or foreach (array_expression as $key => $value) - A construct to loop over an array - http://php.net/foreach
frameworks Questions and discussion about frameworks are not valid topics for ##php. Many frameworks have channels on Freenode where you can ask questions specific to that framework: Zend Framework: #zftalk; Yii: #yii; Symfony: #symfony; SilverStripe: #silverstripe; ModX: #modx; CodeIgniter: #codeigniter; Kohana: #kohana; and so on
g The purpose of ##php is to assist those who have EXHAUSTED their resources (manual, Google, appropriate IRC channels, etc) in developing their own PHP code. We are not your personal slaves; don't treat us like it. Respect the channel guidelines, as ignorance is no excuse. We're not babysitters; please act maturely. Ignoring the spirit of this notice may lead to bans without prior warning. Don't like it? Leave. It's that simple.
g0 The purpose of ##php is to assist those who have EXHAUSTED their resources (manual, Google, appropriate IRC channels, etc) in developing their own PHP code. We are not your personal slaves; don't treat us like it. Respect the channel guidelines, as ignorance is no excuse. We're not babysitters; please act maturely. Ignoring the spirit of this notice may lead to bans without prior warning. Don't like it? Leave. It's that simple.
g1 Guideline #1) Don't ask to ask, Don't state: "I have a question", Don't ask: "Is anyone around?" or "Can anyone help?". Just Ask The Question
g10 Guideline #10) We don't support script(s). We help you *write* PHP, not recommend or download and install/hack/modify/adapt/use pre-written scripts or third party APIs. Contact the authors of the script for support options they provide.
g7 Guideline #7) No spam, bots, scripts, trolls, job postings, away/back messages. All these things decrease our already low signal:noise ratio. Ask me about jobs for more info on job postings.
g8 Guideline #8) If it's not a PHP question, dont ask. Try any of these channels depending on your question: SQL Q's: #sql, #mysql or #postgresql. Apache Q's: #httpd. Linux Q's: Either #yourdistro, #linuxhelp or #linpeople. HTML/CSS/JavaScript Q's: #html/#css/##javascript or #web. Just because some other channel is 'dead' does NOT mean you can ask here.
g9 Guideline #9) Don't PM without permission
globals [GLOBALS] There is $GLOBALS --> http://php.net/manual/en/reserved.variables.php#reserved.variables.globals or you might have meant Register Globals --> http://php.net/manual/en/security.globals.php
gmp_prob_prime int gmp_prob_prime(resource a[, int reps]) - Checks if a is "probably prime" - http://php.net/gmp_prob_prime
go [GO] Gross Overgeneralization. Everything that we tell you in ##PHP is what we consider "best practices". Of course, only YOU know your own requirements, so you may feel you need to do something we told you not to. Just don't say we didn't warn you.
google the God of Wisdom, your best friend, barmate, and all things awesome, or http://www.google.com
guidelines For details, /msg php-bot g<#>, where <#> is any guideline number, or see http://www.hashphp.org -- 1) Just ask. 2) Don't repeat. 3) /msg php-bot smart-q 4) msg the bot 5) Be polite and patient. 6) Do not paste here 7) No spam/bots/scripts/trolls/job postings or onjoin/away . 8) If it's not a PHP question, don't ask. 9) Don't PM without permission. 10) We don't support packages. 11) Always RTFM first! 12) Spelling and grammar ...
hashing http://hashphp.org/hashing.html
hashing passwords Want to hash passwords? Use PHP's new password hashing API: http://php.net/password (native on PHP 5.5; available at https://github.com/ircmaxell/password_compat for PHP 5.3.7+). If you're stuck on an older version of PHP 5.3, use crypt(): http://php.ss23.geek.nz/2011/01/12/Using-crypt.html. On older versions of PHP still? It might be time to upgrade!
headers If you are getting error like "Warning: Cannot modify header information - headers already sent by (output started at /path/file.php:1)" it means you've got some output before your header() call or starting a session. *No* output can be sent. that includes whitespace (outside of ) and any (X)HTML. You can also use output buffering
hosting Please don't ask for or discuss hosting (free, paid, or any other type) in ##php, it is off-topic here.
ide Questions about specific IDEs and IDE discussion in general usually degrades rapidly due to personal preference. It is not a valid topic for ##php.
ides Questions about specific IDEs and IDE discussion in general usually degrades rapidly due to personal preference. It is not a valid topic for ##php.
include bool include ( string filename ) Includes and evaluates the specified file as per the include_path directive. Unlike require(), it emits a E_WARNING if file does not exist.
jobs No job posting or asking for jobs on ##php, please (see /msg php-bot g7). You may want to check out: ##php-lance, http://www.freelancer.com/ or http://www.getacoder.com (##PHP does not affiliate with any of these channels/sites).
just var_dump it Don't echo it, don't print it, don't print_r() it, don't var_export() it, don't file_put_contents() it, don't fwrite() it, don't serialize() it, don't json_encode() it, just var_dump() it and copy/paste the resulting output in a pastebin. See also /msg php-bot pastebin
love no love for you
lsb LSB stands for Late Static Bindings, a mechanism in PHP to access runtime informations about chains of static calls. As ever, the manual can help with the details: http://php.net/lsb
modules Given a copy of the php source in ./php: cd php && cp -a ext/mymodule /tmp && cd /tmp/mymodule && phpize && ./configure --help You're on your own from there.
mv old_name, string new_name[, resource context]) - Rename a file - http://php.net/rename
mysql is old ext/mysql has been deprecated as of PHP 5.5.0 and may be removed in future versions. For new projects use mysqli (php.net/mysqli) or PDO (php.net/PDO). The MySQL developers developed guidelines and a script for migrating your code https://wikis.oracle.com/display/mysql/Converting+to+MySQLi Most people here recommend PDO: http://wiki.hashphp.org/PDO_Tutorial_for_M...
next please another satisfied customer, NEXT!
no one The fact that some other channel is inactive is not an excuse to ask off-topic questions here. Thanks.
nobody The fact that some other channel is inactive is not an excuse to ask off-topic questions here. Thanks.
off topic Prefixing a question with "I know this is off-topic, but..." doesn't magically make it on-topic. (Nor does postfixing a question with that.) If it's not on-topic here, please don't ask -- we get plenty of noise in the channel already and there are thousands of other channels on Freenode alone to chat in.
offtopic Prefixing a question with "I know this is off-topic, but..." doesn't magically make it on-topic. (Nor does postfixing a question with that.) If it's not on-topic here, please don't ask -- we get plenty of noise in the channel already and there are thousands of other channels on Freenode alone to chat in.
opinion We don't give opinions either.
parse error Parse errors show the line where parsing failed, not necessarily where you made your mistake. Try looking a line or two above the reported error.
password hashing Want to hash passwords? Use PHP's new password hashing API: http://php.net/password (native on PHP 5.5; available at https://github.com/ircmaxell/password_compat for PHP 5.3.7+). If you're stuck on an older version of PHP 5.3, use crypt(): http://php.ss23.geek.nz/2011/01/12/Using-crypt.html. On older versions of PHP still? It might be time to upgrade!
password_hash Want to hash passwords? Use PHP's new password hashing API: http://php.net/password (native on PHP 5.5; available at https://github.com/ircmaxell/password_compat for PHP 5.3.7+). If you're stuck on an older version of PHP 5.3, use crypt(): http://php.ss23.geek.nz/2011/01/12/Using-crypt.html. On older versions of PHP still? It might be time to upgrade!
pastebin Submit your code to http://codepad.viper-7.com/, http://codepad.org/, http://3v4l.org/ (particularly for version-specific issues) or http://gist.github.com/ (or any of the other hundred similar Pastebins) and post the URL and a summary of your issue to the channel. Please don't flood by pasting code directly into ##php.
pcre [PCRE] Perl Compatible Regular Expressions - See http://www.php.net/pcre
pcre vs dom Do not use PCRE (or any other flavour of regular expressions) to parse HTML or XML. Not only will it add lots of overhead, but you also incur the risk of having a faulty regular expression that will not match exactly what you want. Using DOM is by far the best way to parse HTML. See http://php.net/DOM
pdo PDO is PHP Data Objects, a database API that has a unified interface for many databases. You can learn how to use PDO here: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers
pear [PEAR] PHP Extension and Application Repository, a library and distribution system for reusable PHP components. ##PHP does not support PEAR, please see #pear, efnet/#pear, or http://pear.php.net/support.php.
pen and paper The best editor is a matter of personal preference. A pen-and-paper solution offers great multiplatform (desk, dining table, wall, you name it) compatibility, while providing features like code folding (just fold the paper), cut/paste (scissors and glue), copy/paste (xerox and glue), and syntax highlighting (crayons), with no charset or encoding bugs whatsoever.
php 101 For an introductory tutorial, for beginners, to get you started with PHP, you may want to checkout http://php.net/tut or http://ss23.github.com/php-tutorial/ or http://sheriframadan.com/php-101
reccommend No, we cannot recommend . We're here to help you write PHP code, not spend hours arguing the relative merits of A versus B. We won't recommend packages, libraries, scripts, sites, languages, version control systems, or sports teams; our only recommendation is that you please don't ask for recommendations.
recommend No, we cannot recommend . We're here to help you write PHP code, not spend hours arguing the relative merits of A versus B. We won't recommend packages, libraries, scripts, sites, languages, version control systems, or sports teams; our only recommendation is that you please don't ask for recommendations.
references PHP references are variable aliases, allowing multiple distinct variables to write to the same value. Don't use references unless you require its functionnality. i.e. don't use them for memory optimizations. http://php.net/references
regex Learn PCRE ( http://php.net/pcre ) here's a tutorial: http://www.articlecity.com/articles/web_design_and_development/article_360.shtml
remember To let users stay logged in for longer than your PHP session lifetime: Pick a random value, save it in the user's record in your database, and give it to the user with setcookie(). Then you can later check $_COOKIE to lookup the matching user record from your db and fill in $_SESSION. For more see http://sheriframadan.com/2011/12/remember-me/
remember me To let users stay logged in for longer than your PHP session lifetime: Pick a random value, save it in the user's record in your database, and give it to the user with setcookie(). Then you can later check $_COOKIE to lookup the matching user record from your db and fill in $_SESSION. For more see http://sheriframadan.com/2011/12/remember-me/
rot13 string str_rot13(string str) - Perform the rot13 transform on a string - http://php.net/str_rot13
rtfm see: http://xkcd.com/293/ to understand why you got this message, then try http://php.net/manual
scope You probably have a scoping issue, see: http://www.php.net/variables.scope
server error "Server error" is a very imprecise description of any fatal error that occurred duing the execution of a script. It's extremely unlikely that anyone would be able to solve an error like that without more indications. You may find very useful indications in your error log, if you have set your error_reporting to an appropriate value. See also /msg php-bot wsod
short tags The short_open_tag directive tells PHP whether the short form () of PHP's open tag should be allowed. Note: This directive also affected the shorthand
shutdown PHP's Shutdown sequence is: 1) registered shutdown functions 2) Object destructors 3) extensions' shutdown handlers 4) ... you don't care at this point ...
sql [SQL] Structured Query Language - the language for most DB Systems. See http://www.sqlcourse.com/ http://www.onlamp.com/pub/ct/19 and #mysql, #postgresql or #sql
sql tree Your database design would appear to fall into a classic SQL anti-pattern known as "Naive Trees". I strongly recommend you review http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back - epsecially the section beginning around slide 48.
ss23 ss23 says: Note to self: Think of a cool phrase and add it to php-bot with the start "ss23 says: "
sscce sscce is a minimal independently runnable program, which demonstrates the problem; see http://www.pscode.org/sscce.html for details and a HOWTO
survey If you have to ask "Does anyone here use foo" or "Are there any baz experts around" you're just taking a survey. You'll likely get an answer quicker if you just ask specifically what you need help with.
ternary [ternary] Like many other languages, PHP has a ternary operator (?:). It serves as a compact if/else syntax. See http://www.php.net/manual/en/language.operators.comparison.php
test Yes, yes, I'm here.
thinking TML says: First, you need to learn to think. That's going to be the hard part. Once you know how to think, you only need to spend a short while with any language to learn the syntax, and BANG! You can program in that language. It's that first one that trips everyone up.
third party ##php does NOT support third party applications. However, there are limited solutions: 1) Ask in the corresponding channel of the application, 2) Contact the authors/vendors, etc
tias [TIAS] Try It And See. If you want to know if or how something works, try it first. "Testing Is Absolutely Simple"
tidbits Please don't paste some tiny bits of code, out of their context, or code you retyped "to make it cleaner", as it is likely to also remove the specific part that won't allow your code to work properly. Paste your whole code, or a significant part of it (whole function, method, or class, for example). See also /msg php-bot pastebin
tidbits of code Please don't paste some tiny bits of code, out of their context, or code you retyped "to make it cleaner", as it is likely to also remove the specific part that won't allow your code to work properly. Paste your whole code, or a significant part of it (whole function, method, or class, for example). See also /msg php-bot pastebin
tutorial PHP Tutorials: http://www.google.com/search?q=php+tutorial as well as http://www.php.net/tutorial
u Surely you mean 'you', not 'u'? The letter 'u' is not a personal pronoun. There are people in ##PHP for whom English is not their native language, and idioms like this can create confusion. Please show respect for others by refraining from this type of slang.
ugly < rasmus> PHP is ugly. It was meant to be ugly. If you don't like ugly, don't use PHP.
unset void unset ( mixed $var [, mixed $var [, mixed $... ]] ) - unset() destroys the specified variables. http://php.net/unset
url_encode lda, FTCHU, string urlencode ( string $str ) - URL-encodes string - http://php.net/urlencode
using crypt http://php.ss23.geek.nz/2011/01/12/Using-crypt.html
usort closure function buildSorter($key) { return function ($a, $b) use ($key) { return strnatcmp($a[$key], $b[$key]); }; }
variables Read Derick's article about how PHP variables work under the hood here: www.derickrethans.nl/talks/phparch-php-variables-article.pdf
why PDO For the most part, what PDO does is give you access to parameterized queries, which are fundamentally different than escaping. In parameterized queries, "data" (such as your variables) and "code" (the SQL) are sent along different paths, so that there's no *possible* way for "data" to leak over into the space of "code", which is fundamentally what is happening when you have SQL injection.
why pdo For the most part, what PDO does is give you access to parameterized queries, which are fundamentally different than escaping. In parameterized queries, "data" (such as your variables) and "code" (the SQL) are sent along different paths, so that there's no *possible* way for "data" to leak over into the space of "code", which is fundamentally what is happening when you have SQL injection.
windmill Windmills do not work that way ! http://www.youtube.com/watch?v=ZQg8JKo_3ZQ
working Look buddy, doesn't work is a strong statement. Does it sit on the couch all day? Does it want more money? Is it on IRC all the time? Please be specific! Examples of what doesn't work tend to help too. Finally, showing us the code is helpful (after you've explained your problem). /msg php-bot pastebin for more information
wsod White Screen Of Death: If you're seeing a blank page (and view-source is empty), make sure your php.ini contains error_reporting = -1 and display_errors = On (only recommended for development). Putting: at the top of your script might have no effect if your script fails to compile such as in the case of PARSE errors.
xy The X-Y problem is when you want to do X, but you don't know how. You think you can hack X if you can just do Y, but you don't know how to do Y either. You ask (us) for help with Y. We think Y is a strange problem to want to solve... So just ask us about X.
zend 101 Modernized Zend 101 - http://ss23.github.com/php-tutorial/ (original can still be found at http://devzone.zend.com/6/php-101-php-for-the-absolute-beginner/)
12345 1) What's the expected behaviour? 2) What's the observed behaviour? 2b) Are there any errors? ( /msg php-bot error reporting ) 3) How do these behaviours differ? 4) What's your current code? ( /msg php-bot pastebin ) 5) What's your current setup (OS, php version, etc...)