« first day (646 days earlier)      last day (4524 days later) » 

18:05
@ircmaxell Hey, it's your reddit birthday!
please, no cats :}
0
A: Displaying a table in PHP with repeated columns

ircmaxellI would solve this in a different way. Right now, you're having issues because you're database schema is not normalized. Instead, I would start off by altering the schema. Right now, you have this: CREATE TABLE foo { `autonum` INT(12) NOT NULL AUTO_INCREMENT, `id` INT(12) NOT NULL, `...

18:25
I'm guessing that rep is deducted as soon as you start bounty?
how much do you get for each visitor ? $0.00001 ? Just curious ..
and how much unique visits?
@tereško garbage...
18:35
and so I cry sometimes when I'm lying in bed ♪ ♬ ♪
Lounge<C++>
FredOverflow: YouPorn
and you warn me about posting link :P
hi, i'm new to PHP. How could I concatenate this "echo" statement into a string (for echoing out later)?

while ($row = mysql_fetch_array($result)) {
//Display the results in different cells
echo "<tr>
<td>" . $row['FIRST_NAME'] . "</td>
<td>" . $row['LAST_NAME'] . "</td>
<td>" . $row['RIT_ACC'] . "</td>
<td>" . $row['LINK_1'] . "</td>
<td>" . $row['LINK_2'] . "</td>
<td>" . $row['LINK_3'] . "</td>
<td>" . $row['LINK_4'] . "</td>
<td>" . $row['LINK_5'] . "</td>
<td>" . $row['LINK_6'] . "</td>
</tr>";
One way would be
$output = array();
$output[] = '..output here..'; // lots of these
echo implode('', $output);
Thanks Mike, I'll give it a shot. :)
$i = 0;
while ($row = mysql_fetch_assoc($result))
{
    $td = '';
    foreach(array('FIRST_NAME', 'LAST_NAME', 'RIT_ACC', ) as $key => $value)
    {
        $td .= "<td>" . $row[$key] . "</td>" . PHP_EOL;
    }

    $echo[$i] = "<tr>" . $td . "</tr>";

    $i++;
}
mysql_*??? kill it with fire!
18:49
@TomC so, output from all iterations is saved in $echo array
I don't care, all they need to do is look at the right side of the screen...
@TomC use mysql_fetch_assoc to save memory, if you don't need numeric keys
Noted for future projects :) right now I just wanna get this current one DONE, then I'll revise haha
thank you for your help!
I thought this is paid support chat
Hey is there any more list like this one.?
http://www.phpbench.com
some one.?
@BasicBridge if you need to optimize at the micro/nanosecond level, you damn well better be able to write your own benchmarks
@webarto: what does the PHP_EOL portion of the code snippet you gave me do?
actually nevermind, I'll find it myself :)
18:56
@TomC it is newline based on your system e.g. \n
not to mention that benchmarks are more relevant if run on your own system
@webarto Oh, nifty! thanks!
somehow I think that these results don't make sense... in one test concat when echoing is faster, in other, it isn't...
@orourkek well me try to do that. but that's too much hard job time consuming.
// Test Source
function Test7_2() {
    global $aHash;
    $someClass =& new SomeClass2();

    /* The Test */
    $t = microtime(true);
    while($i < 1000) {
        $obj =& $someClass->f();
        ++$i;
    }

    return (microtime(true) - $t);
}
18:59
@BasicBridge if running benchmarks is too time consuming, perhaps optimizing is not your chief concern?
global, yeah...
lol. :D
evening
global AND object references
and globals that are not used :D
<?php

// Initial Configuration
$isset       = true;
$array       = array();
$notSetArray = array(0=>'');
$string      = '';

// Test Source
function Test9_11() {

    /* The Test */
    $t = microtime(true);
    while($i < 2000) {
        is_array($notSet);
        ++$i;
    }

    return (microtime(true) - $t);
}

// Variable Clean-up
function Test9_End() {
    global $isset, $array, $string;
    unset($isset, $array, $string);
}

?>
maybe he was watching porn and flash consumed his CPU power
19:00
why do you keep hurting us ?
I have no soul
that is apparent
but these guys have no brain
hello everyone!
@webarto oh , you are talking about http://www.phpbench.com/
19:02
hi
@tereško yes he is
yes I am
Is there any easy way to create mysql table duplicate using clear php? Without mysqldump, mysql shell access, phpmyadmin etc.
OK so I have 2 vars and an array which, combined together, create an html table. I now want to echo that table out inside of a specific DOM element... Would I Just echo out a jquery statement to do that and plug the PHP vars inside of it?
I know it possible to create empty talbe CREATE table LIKE table
I want to automatically backup tables for ecommerce website before importing products to avoid "OMFG" situations.
19:04
@tereško The gods of micro-optimization
@Kirzilla , thats why we have mysql_dump
@GordonM that site leaves me with a feeling of failed suicide
The way I see it, if you need to fettle microsecond-level performance improvements out of your code then you're not going to be writing it in PHP anyway.
@tereško you've developed some custom extension for php or it is regular function? I can't see any docs for such function
but siriously, come on... just put bunch of processors and write normal code...
the last list i got is this.
http://www.chazzuka.com/63-best-practice-to-optimize-php-code-performances-58/
it does not include codes. just some tips.
19:07
Micro-optimizing PHP code is like putting expensive high-grade fuel in your Nissan Cherry
@GordonM nice :)
@GordonM hahahaha
If a method can be static, declare it static. Speed improvement is by a factor of 4.
@GordonM uh huh...
@tereško see my original message. I've asked without mysqldump
41
A: Why is PHP apt for high-traffic websites?

ircmaxellWhat you'll usually find is that it's not as slow as you think. The reason a lot of sites are slow is because the hosts are overloaded. But one primary benefit of PHP over a compiled language is ease of maintenance. Because PHP is designed from the ground up for HTTP traffic, there's less to b...

And that's not meant as an attack on PHP, it's really not. It's just if you need to performance tune to that extent then you probably need a compiled language or even assembler.
@ircmaxell See previous comment!
I think it's okay to mean it as an attack, too ;)
@webarto Stop it. You're making me not want to live anymore
19:10
As far as I see mysql SELECT allows to INTO OUTFILE ...
After all, PHP is slow ^^
slow is relative. It's plenty fast enough for 99.999% of sites on the internet
if (isSet($foo) AND is_array($foo))
There's nothing wrong with PHP for what it was meant to do (Well, okay, maybe there stuff wrong with PHP, but performance isn't one of them in the case of interactive websites which is what it was meant for). You just wouldn't write a raytracer in it.
can someone check this, it says, running is_array on undeclared variable is 6x slower
(wondering how can you run is_array on undeclared variable)
19:11
@webarto because it generates a notice
@webarto And? 6x slower than almost instant is still almost instant
and we are talking about 1000 iterations in an instant...
It's the warning that ends up on the screen/in the log that's more problematic
@ircmaxell thanks
The former because you're leaking information about how your script works and it looks unprofessional, the latter because you can fill up a hard drive with error logs very quickly in high traffic sites that emit a lot of notices/warnings
19:13
but like I said, I can't think of a way you want to check if variable is an array, if it is not declared previously...
doesn't matter, just f* write clean code :)
@webarto if you use global variables, you will run into that
Saving developer time is worth far more. Developers cost more than Xeons :)
or checking if a key in an array is another array...
@GordonM unless you have tens of thousands of xeons. Then developers become far cheaper...
hey guys, how can I specify an html DOM node (in this case, a div) to echo out some vars to? I feel like an idiot asking this to all you php pros, haha.
19:15
@ircmaxell In which case, you're probably not using PHP because it's a web scripting language and not meant for implementing supercomputer workloads :)
0
A: Passing Value to PHP File

webarto<img onclick="document.getElementById('form1').submit();" src="../img/search.jpg" width="70" height="45" border="0" align="left" usemap="#Map">

not enough jQuery?
@GordonM you are saying this second time. Then which to use.
For websites? Use PHP!
@GordonM are you saying that Facebook level traffic requires a supercomputer?
@GordonM facebook is a website
Facebook is using 60,000 servers...
@ircmaxell Well it'd need lots and lots of bandwidth and platters, for sure. Whether that constitutes a supercomputer depends on your definition I guess.
19:17
Well Facebook uses HIPHOP php. I have no idea about that. But it just make it fast since 2008 or 2009
what is amazing is that Wikipedia has about 400... I understand content is mostly static... but still...
60,000why this much?
@PedroGabriel Cos millions of hits an hour?
makes sense, how many Google has?
@webarto No, the difference in scale is signficant
19:19
@PedroGabriel 1M+
@ircmaxell sorry can you rephrase that please
It's not only the number of hits, but also to reduce latency by distance
the difference between google and facebook, #1 and #2, is huge in terms of traffic difference...
A power law is a mathematical relationship between two quantities. When the frequency of an event varies as a power of some attribute of that event (e.g. its size), the frequency is said to follow a power law. For instance, the number of cities having a certain population size is found to vary as a power of the size of the population, and hence follows a power law. There is evidence that the distributions of a wide variety of physical, biological, and man-made phenomena follow a power law, including the sizes of earthquakes, craters on the moon and of solar flares, the sizes of activ...
what does akamaihd.net really do with GOOGLE , FACEBOOK AND TWITTER
it hosts static content
@ircmaxell @PeeHaa thanks
hey, I got a weird question
If you were a PDO connection, I input into your prepared query using a Hash (#) what would you do?
19:21
@PedroGabriel I would smoke it
@PeeHaa hahaha
@BasicBridge akamai.com
@PedroGabriel huh?
I would wrap myself and smoke hash-ish
My connection thinks a bit different, he comment the whole query like a fail
@PedroGabriel What does the statement look like? (sorry ultra mega ping)
19:23
The technological singularity is the hypothetical future emergence of greater-than-human superintelligence through technological means. Since the capabilities of such intelligence would be difficult for an unaided human mind to comprehend, the occurrence of a technological singularity is seen as an intellectual event horizon, beyond which events cannot be predicted or understood. Proponents of the singularity typically state that an "intelligence explosion", where superintelligences design successive generations of increasingly powerful minds, might occur very quickly and might not stop u...
the day has come
Like this
$q = $con->prepare("UPDATE $table SET value=:value WHERE senha=:senha AND var=:var");
$q->execute(array(':senha' => $senha, ':value' => $ar[$i+1], ':var' => $ar[$i]));
And where is the hash?
On user input
@webarto well you can rest easy knowing that computers will never be able to accurately predict the future. At least that's something...
:value is empty at one point?
19:25
Hmmmm it really shouldn't do that
OK, got some jquery hax that make Rubberband behave properly in IE8. But I really could do with a contributor or two who could rewrite it to work in POJS. Wonder where you can go to solicit for contributors to a Github project?
:value and :senha (means pass) would be the user input
if he wrote like
123#
@orourkek pedro says his connection has mind of its own.. so.. :)
@PedroGabriel Please just use english words when coding
paste entire code, you are not making sense
senha = password, as they say in France
19:26
@GordonM What is rubberband?
WTF? Are you storing passwords in plain text?
@webarto unless he has a functional & stable quantum machine, we're safe :]
http://pastebin.com/6rpq1yqe
a "test case" where has a lot of errors or mistakes, but I want to fix # first
config.php: http://pastebin.com/f1NUstJ8
@ircmaxell no, he is using MD5, it is safe then :P
19:27
@GordonM Aren't there any fluid FWs?
@ircmaxell If you haven't missed a day in basically two years, you don't have enough going on in your life outside of tech.
Searching for CSS grids usually just got me links to 960.gs. There probably are some out there, but I figured trying to build one would be a nice little exercise.
@LeviMorrison I would agree with that statement
I don't know why # comments still working, "--" one has stopped
@GordonM Always good to build stuff yourself. Not going to argue there :)
19:29
$buff = urldecode(addslashes($buff)); -.-
@PedroGabriel tell me one thing: are you storing passwords in plain text right in the db?
I said a lot of errors/mistakes
But a POJS implementation of my IE8 shim is a bit beyond me, I'm afraid.
It's not a real password
not a real password?
19:30
@ircmaxell (╯°□°)╯︵ ┻━┻
It's a fake one to divert hackers how smart
looks like a pointer, for storing always in the same row
I could use MD5 too, but would be useless
@PedroGabriel You're right about that
:-)
But not for the reason you think it is I'm afraid ;)
Finally I'm right about something :D
so... noone know about #
md5 is not much safe
19:34
use 4 MD5 in one then
use 10 still not safe
@PedroGabriel I know it shouldn't do that AFAIK.
md5(md5(md5(md5($password))));
Seriously TF2, please stop dropping goddammed crates. I don't want to pay £1.99 for another jarate.
9 is enough.
@GordonM wat is TF2
19:36
team fortress 2
ah, me no play games, GPU 128MB
29
A: Many hash iterations: append salt every time?

ircmaxellIn short: Yes. Go with the first example... The hash function can lose entropy if feed back to itself without adding the original data (I can't seem to find a reference now, I'll keep looking). And for the record, I am in support of hashing multiple times. A hash that takes 500 ms to genera...

@webarto ah same here
Additionally
79
A: Fundamental difference between Hashing and Encryption algorithms

ircmaxellWell, you could look it up in Wikipedia... But since you want an explanation, I'll do my best here: Hash Functions They provide a mapping between an arbitrary length input, and a (usually) fixed length (or smaller length) output. It can be anything from a simple crc32, to a full blown cryptog...

The section on "Trivial Stretching"
@ircmaxell I don't need to tell you that you are right :)
19:38
@rdlowrey I assume your missing presence means you are still with family?
what about crypt blowfish.?
Mother of answer, he wrote a book
if I want to echo an html-formatted string inside of a DIV, how would I do that?
or rather, to a div, without using inline php
<div>'.$string.'</div>
19:40
@ircmaxell IMHO that should be in manual for MD5, SHA1, etc
@BasicBridge I want to echo it out to a specified div, with an id (like jquery append)
use Template
@BasicBridge the best answer for how to store passwords
or use JS
I can use JS, im just not sure what to do
19:42
@ircmaxell thanks.
basically I have these html-formatted strings that form an HTML table. I need to have them sent into a specific div in the html body
Use inline :D why cannot do it?
maybe I could.. I'm just new to PHP and not very good :) currently the div I want to insert into is not a static HTML div, but was generated by PHP on load from mysql data
load it, store it, show it where you want
Okay, no one know why # keep commenting
I'll update my code and make a question about it.
huzzah I got it! :D I just used a simple isset check inside of the div.
19:52
so, you're loading from db, check if loaded using isset?
 2+ years professional PHP4/5 experience.
:'(
2+ years normal people PHP4/5 experience.

Get nothing for learning it :'(
@webarto If they want two years of PHP4 experience, I'd avoid it.
@LeviMorrison yeah, I only know 5.3+ :)
Ok, guys, here is the plan:
- Farewell mysql_*
- Store passwords like @ircmaxell says
crypt blowfish?
20:01
@webarto I sure hope getting good test coverage is on your plan . . .
@LeviMorrison rephrase please, me stupido
No one here uses PDO?
what a nice joke
haha
@PedroGabriel Everyone* here recommends PDO.
* @ircmaxell prefers MySQLi, if I remember correctly.
20:04
Everyone but @ircmaxell :)
Ha you're fast
@PedroGabriel If you have any questions about mysql_* functions @tereško is the guy you want to see
So, if everyone use it, why no one know how to use # inside prepared query ._.
when accepting an answer, can the users post another answer to the question?
cause we all use query builders :P
@PedroGabriel From the looks of the room, most people are busy at the moment.
20:05
@GeoPhoenix Yes, additional answers may still be posted
@webarto . . . I don't think so . . .
I made my qyestuin when they were here (some of then) and they only would smoke it
yeah, we smoke POD a lot
query builders?
20:06
nevermind
what is your issue?
@PedroGabriel example query builder: framework.zend.com/manual/en/zend.db.select.html
The same issue # commenting my query
please ask clear question, and you will get clear answer
@PedroGabriel You need to use the literal character # in a query? And it's not a query parameter (placeholder variable)?
20:08
@PedroGabriel You said it was a parameter
??
my yeah were delayed
@PedroGabriel Can you show me the SQL snippet and your PDO code?
Eg:
$q = $con->prepare("UPDATE table SET value=:value WHERE pass=:pass AND var=:var");
$q->execute(array(':pass' => $pass, ':value' => $value, ':var' => $var));

:pass, :var and :value are user input
if user input 123# on :value would comment WHERE
Hi, I need some php url help. I have $(dollar sign) in php url. and its giving me an issue. actually the dollar sign is not encoded in php url.
any one know about.
20:10
@PeeHaa :-D
@abdulwakeel What is a PHP URL? And what do you do to encode it?
url.com?sud=12553&cuid=33054&_$ja=tsid
@abdulwakeel And how are you encoding the data?
more... url.com?sud=12553&cuid=33054&_$ja=tsid:33|cgn:NZ&ICA|wc:logo
20:16
using rawurlencode and some str_replace
like $p = str_replace('%7C','|' , $p);
@ircmaxell What have you got against PDO? Is it just that emulate prepared statements business?
@abdulwakeel Well you are doing something wrong, because *urlencode will encode a dollar sign
if user input 123# on :value would comment WHERE
cause theres no single quotes
@PedroGabriel Wait. Wut
@PeeHaa , can you suggest, what should I use.
20:18
@abdulwakeel Can you dump your relevant code somewhere?
@PeeHaa let me try
@GordonM No, I think it's a poor API that promises to solve lots of issues that it doesn't deliver on. MySQLi is a bad API, don't get me wrong, but at least it's straight forward exactly how it works...
You're just coupled to MySQL if you use that though.
CodeIgniter - if i'm only using a helper / library on say - 60% of the functions (for example, the url helper) should I load them in the auto loader or load them per-method basis?
@PeeHaa please use the above url
20:21
or does this depend on the loaded helper/library and how heavy it is? is there a 'rule of thumb'?
@rlemon autoloader (tries) loads them when they are requested?
hey all :) I have this chunk of code:

$echoResultArray = array();
$i = 0;
while ($row = mysql_fetch_array($result))
{
$td = '';
foreach(array('FIRST_NAME', 'LAST_NAME', 'RIT_ACC', 'LINK_1', 'LINK_2', 'LINK_3', 'LINK_4', 'LINK_5', 'LINK_6' ) as $key => $value)
{
$td .= "<td>" . $row[$key] . "</td>";
}
$echoResultArray[$i] = "<tr>" . $td . "</tr>";
$i++;
}
//Table closing tag
$echoResultsClosing = "</tbody></table>";
mysql_close();

$echoResultData = '';
foreach($echoResultArray as $var)
{
$echoResultData .= $var;
so, reading I could use str replace, replace # by something like ŋ and then store on db
@webarto ahh - I thought it just created a large stack infront with all 'included' files. I should read the source code a bit more
@ircmaxell hey if Mysqli is bad why PHP.net is advising to use to it.
20:23
@rlemon don't take my word for it, but you are not loading "all" classes, you load only classes that are required by your code (or FW's code)
@PeeHaa first I clean rawurldecode(html_entity_decode($link, ENT_COMPAT, 'UTF-8'));
Damn that is hard to read :P Please start using curly braces
you and curly braces :P
@BasicBridge I said the API design is bad, not that MySQLi is bad. It's quite good actually
20:24
@GordonM Don't kid yourself. You're just as coupled to MySQL if you use PDO...
@webarto :)
@abdulwakeel why aren't you using parse_url() and parse_str()?
@webarto There is a reason I'm trying to educate people to use it.
@ircmaxell I've used it jsut fine with Postgres
@ircmaxell We try to write as much generic SQL as we can, but it's hard to not use any MySQL specific code.
Especially once you get into dates and things.
@PeeHaa the logic build by some one else, and its running from years. so I need a quick fix now.
In fact it works quite nicely with Postgres, you get data back in a PHP type that best matches the column type for a start, unlike everything coming back as a string from MySQL
20:27
@ircmaxell If we ever change from MySQL it will be to Postgres, but if we use PDO we don't have to change our PHP dependencies, just our queries.
Less work.
@PeeHaa it looks like you personal website is on jquery mobile.
check out this one too http://www.ameeto.com
sorry OFF-TOPIC
okay then, replace # by some useless (like ø) or still making the same question on Stackoverflow until someone answer? (abount PDO # commenting my query)
@PedroGabriel Did you turn off emulated prepares?
yes
$con->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@BasicBridge What am I looking at?
20:30
it's my friends website. He developed this. I don't no what he uses in backend. but he uses jquery mobile
@PeeHaa I'm sure there is, mind sharing it?
@webarto Readability. Knowing what to expect.
@BasicBridge on his error page s/Sponcered/Sponsored
ugh
@GordonM I think you missed my point
tell him to put an about page as well.
20:33
Check out this guys answers stackoverflow.com/users/1546792/yariv
spam right?
I always write { in newline, when I do :P @PeeHaa
I hate sites that don't tell you what they are!
@LeviMorrison If you're using a data mapper, and not littering your application with database calls all over, what does it matter if you're changing dependencies? It's in the layer you're touching anyway...?
@ircmaxell That if I used PDO I'd be coupled to MySQL? Honestly, I don't see how.
@GordonM No, that if you use MySQL with PDO, your application will be coupled to MySQL.
the interface is the weakest point of coupling in the system. The data model, and SQL functionality is the biggest point of coupling. And PDO doesn't solve that problem
20:35
@ircmaxell Because your queries are still written for MySQL? i.e. SELECT ... LIMIT 10
you'd need a full blown query builder or ORM to solve that problem
@rlemon ow i will inform him.
he is just 19 year it's a social networking. I think he done good job. 'casuse i can't do it
and even then, it's not a great solution because it quite often generates sub-optimal queries
OK, the queries you run through PDO are going to be vendor specific, that's a given (unless you limit yourself to SQL standard queries), but all the code that interacts with the database does so through a PDO object and as long as it gets the right results back it doesn't matter if that PDO object is talking to mysql or postgres or sqlite.
@ircmaxell I'm honestly okay with that. The systems I've seen that do try to solve that problem are nasty.
@BasicBridge also tell him jQuery mobile sucks. Personal opinion of course. I've used it for work - hated it with a fury - I convinced to use twitter bootstrap + responsive design.
20:36
okay then, I'm going to sleep sad :<
@ircmaxell Sure, but it is still less to change.
@rlemon do you use jQuery templates?
@GordonM If you're structuring your applications where anything related to PDO leaves the data mapper, you're doing something else wrong...
@webarto nope if I have to do any client side 'templating' I use my own
@abdulwakeel I'm sorry I really tried to read it but it just hurts my eyes too much. Which is probably part of the issue you are having
20:38
@LeviMorrison less to change on the scale that it adds a hour to a 2 week process...
@PeeHaa , thanks very much.
@ircmaxell I highly doubt it would be a two week process where I work.
things like scripts in the body etc.
@LeviMorrison between data migration, testing, performance testing, data structuring, QA... It'd be 2 weeks for any project of significant importance or scale...
20:39
How to edit messages in here ~ they can only be edited faster
@rlemon well JQM is not much supportive right now by the browser. Okz i will
If you want to make an app database agnostic with PDO you need to rewrite query strategies for each database. If you're using MySQLI and want to make your app database agnostic you need to rewrite the queries AND the code that interfaces PHP with the database. Worse, if you're going from an OO-mode mysqli to postgres you also have to write code to wrap the procedural postgres extension functions in a class!
or you could use ODBC and feel the pain! :)
0
Q: How to merge two Mpeg file wih PHP

João MosmannI'm using the Google Text-to-Speech to make a game. But, the TTS have a limit of 100 characteres per request. So, I splitted the text, and now i do more than one request to synthesize the complete text. Now, i have the binary of sound of my text splited in two files. Just doing a simple $au...

L-O-L
Seems to be cool
$audio1 .= $audio2 - operator overloading would be sweet in this case
20:41
Just doing a simple
$audio1 .= $audio2
... dont work.

obviously it doesn't work, they got headers
Have it decode both clips, combine, and reencode with one call
How he made to download the speech?
@GordonM So, it's isolated to a small layer of perhaps 3 or 4 classes...?
penisland.net lol whats in a name
@MikeB or use tool for that, right?
20:44
@ircmaxell In my experience they don't tend to be as small as you'd like.
small as in breadth. Meaning it's a small percentage of your overall application
@webarto Sure, under the hood in the overloaded .= operator. $clip1 .= $clip2 makes sense to me as a developer; reading that code.. append clip2 to clip1
@rlemon lol
@MikeB yes, makes sense, but for example, what will you have if you merge 2 pictures :)
they are binary files, it's the same to concatenating 2 PNG, they both got a header
Dam, he's fast
20:47
@rlemon , this was actually features in some "Top10 worst domain names" roundup
nice
this one
lol I never ever put together expertsexchange.com (expert sex change.com)
@webarto Whatever you want $image1 .= $image2 to mean :p
I was just pointing out a cool use-case for operator overloading (something that doesn't exist in PHP - I'm sure for good reason)
I really don't want to repeat that for this domain again
@GordonM if you have separate classes for dealing directly with SQL ( something that implements data mappers ) then switching to a different storage solutions (SQL is not the be-all-end-all of stoeage) is simple
yes, you need to rewrite the queries , but that is only thing you really need to change
@MikeB yes, because that is not like adding two numbers :) It can mean a lot of things. But we get each other...
@tereško if you used PDO you'd have to rewrite the queries, if you used mysqli for mysql and postgres for postgresql and sqlite for sqlite then you have to write a storage solution class for each of those as well, assuming you want to give them a uniform interface. PDO provides you with a uniform interface already. So why not just use that?
Additionally, PDO doesn't support a large breadth of possible storage engines. MySQL and Postgres are only 2. What about Mongo or Cassandra or MariaDB or all of the other engines that aren't (and shouldn't be) supported by PDO?
@GordonM , if you for some reason do not use an abstraction for DB connection , but still want to switch RDBMS , then you have to write the abstraction yourself
I'm a lazy guy and I'll just use stuff if it's already available to me. What is it about PDO that's so awful and terrible and evil that writing my own collection of classes is worth the extra work?
bad defaults
20:53
Thats it?
bad information
Then just set the defaults yourself when you instantiate a PDO.
also , as maxell pointed out , what if you want to switch from RDBMS to a NoSQL storage ?
I'm not on a crusade against PDO. I don't care for it, but I'm not yelling at others to avoid it. But when people come out and spout fud about how bad mysqli sucks and how you're an idiot if you don't use PDO, well, that's a big problem in my book
If you want to switch away from SQL entirely then PDO wouldn't help you, true. Then again it never claimed that it would.
20:55
Sure you did:
16 mins ago, by GordonM
If you want to make an app database agnostic with PDO you need to rewrite query strategies for each database. If you're using MySQLI and want to make your app database agnostic you need to rewrite the queries AND the code that interfaces PHP with the database. Worse, if you're going from an OO-mode mysqli to postgres you also have to write code to wrap the procedural postgres extension functions in a class!
there are two things that suck about mysqli: the naming convention for methods and the lack of named parameters .. both are convenience things
I don't recall spreading any FUD about mysqli, I've not got a strong opinion about it one way or the other, other than it's easier replacing mysql_* with mysqli_* in a grep than rewriting vast swathes of code to use PDO.
@webarto His answer really handle it? it's on Linux, not PHP huh
replacing mysql_* with mysqli_* using a grep isn't really a solution :P
@tereško it is little complex in typing too.
20:56
if you are replacing mysql_* with mysqli_ then you are doing it wrong
@tereško I like the lack of named params.
Having said that, if you're going to switch, then PDO offers a bit more flexibility than Mysqli, so if you're developing a new app, why not go with PDO?
@ircmaxell , as i said , its a convenience thing
for me, the only thing that sucks about MySQLi is the reference binding
@ircmaxell huh? Sure I did what?
20:57
@tereško it also provides more room for bugs. As it requires a parser...
you don't really have to do the reference binding, do you?
@PedroGabriel sorry, can you rephrase that please... I can't connect the dots.
Never mind :P
@GordonM Honest question: how many applications have you built that you switched to a different RDBMS more than half way through the project?
None, but I've worked on a couple where some customers wanted postgres and some wanted mysql.

« first day (646 days earlier)      last day (4524 days later) »