« first day (1207 days earlier)      last day (3967 days later) » 

16:00
No you overwrite
foreach($items as $item) {
  $item = $basket->appendChild($dom->createElement('item'));
it is mathematical. If you want them to be unique there is a minimum length regarded as acceptable. Otherwise why not use
00000001
00000002
00000003
...
00000016
etc?
When you execute this I got what I want
( IF there are no duplicates in it:
Thanks too: @BasicBridge
@PeeHaa OK, I really hate SagePay. I'm following the documentation for integrating SagePay and it says they have to be in <Item>
page 51
@Styphon It does, but nowhere in those docs does it state: "And now you have to overwrite your PHP variable in your foreach loop"
@PeeHaa I'm sorry, but I don't understand
If I reuse a variable in a loop how is that overwritting something that I've already created.
If I create an append something then surely I can't overwrite it
16:04
Where do you append??
Same line
$basket->appendChild
And where do you append it to $item?
xml I don't miss you
Item is appended to basket
Not the other way around
Item is a child of basket
$item = $basket->appendChild($dom->createElement('item')); creates Item and appends it to basket in one line
@Styphon And then in the line below that you use $item->name
16:07
No
I append a child to item
umm, yes?
I don't think you know what append means :P
Add a child element
$thing->appendChild('stuff is appended');
@Styphon wot
16:08
$thing = 'stuff is overwritten';
You see the difference in the above?
@PeeHaa Yes, but I don't get your point
In the first line of the loop you're overwriting the $item variable and assigning to it the return value of $basket->appendChild(). The very next line you're using $item but it is simply the DOMNode that you just appended; which doesn't have any value in it.
user895378
I'm not sure how put.io can exist without getting sued/prosecuted into oblivion ... they're just asking for it.
@cspray I know, it's a parent node, it's not meant to have any value
@rdlowrey But but but foss repos! :P
16:10
Its a container node
that's all it's for
@Styphon So what? You're using it in the very next line as if it does have a value in it
You just admitted that it doesn't have a value but in your code you expect it to have one?
user895378
@PeeHaa totally. That's definitely the only thing I've ever used torrents for ;)
@cspray that makes no sense
@cspray how does $basket work then?
@cspray surely that has no value too then if item has no value?
yet look at the output
it works
what you say makes no sense
The problem here is that you're overwriting the $item variable in the foreach loop
16:12
ok
at the end of the foreach loop $item no longer exists
$item only exists inside the foreach loop
ok people! Empty your pockets!
I just had an $item variable here
a variable created in a loop can only exist in that loop
Who stole it?
So if I create an item in a loop, in the next loop it's empty again
16:13
Nobody leaves this room until I have found my variable
ready for me to use freely
I'm not talking about a different loop
You're overwriting in the same loop
How?
Also what you just said it bollocks
foreach ($items as $item) {
    $item = 'something else';
}
$item is no longer the next element in the array after the first line of the loop. It is 'something else'
16:14
Oh fuck me, finally I get what you're sayin
typo from copying the code over
it's because in my actual code it's foreach($this->glob->basket->basketItems as $bItem) {
nvm people I think I just found my variable! Carry on people. Nothing to see here
OK
Corrected and still error
@PeeHaa eh? will $item still be there outside the loop? i always thought it's scope is just inside the loop. wahaha
@Danack pthreads? I have to compile that in right? I am using default PHP found in Ubuntu repo and running the code as cli-server
@Styphon $bItem['name']
You're dealing with arrays not objects
user895378
16:18
@NikiC is there a zend-sanctioned (read: built-in macro/function) for int to string conversion (outside of the zval manipulation API) or can I just do char mystring[42] with a sprintf when I know it can't possibly overflow?
hmmm
@cspray GAH! arrays not objects here
objects in my live code
yea, corrected and it outputs
@reikyoushin php is function scoped
@Styphon only thing is they aren't objects
The only thing is one weird error I don't understand eval.in/97916
16:21
@rdlowrey don't think so. using zend_spprintf should be okay
Ah, it doesn't like the ampersand
user895378
@NikiC k thx. If at any point my internals questions get annoying just let me know ;)
Also html_entity_decode() doesn't mean what you think it does
It converts &amp; into &, and likewise, does it not?
I'm sure the answer is somewhere in there ^
16:25
OK, well it's working on the simple exmaple
That doesn't explain why it isn't working in my code
You really need to look into what xml is
Or more specifically what you can use as text
OK, replacing the ampersand with and and then htmlentities got it working
@rdlowrey Torrents by themselves aren't bad at all.
user895378
@LeviMorrison I agree. But that won't stop the big guys from suing you into oblivion over it.
16:32
Torrents are probably the best way to get iso files for OS distributions.
@BasicBridge Probably because it's a horribly presented splurge of code.
It's more of a behavior thing: do they allow you to share the files you've torrented? If so then it may be a problem, but if it's personal it may not matter.
But, looking at some of their examples... yeah they'll probably get sued.
@Leigh ah this mess, but it answers his question. :(
@BasicBridge ($x), '<a href="#'.$x.'">' . '<h2>' and`'offers'.'</h2>'.'</a>'` <-- doesn't do much
16:35
@BasicBridge No, I don't think it really does answer the question. All you do is provide a hard-to-read line of code with no explanation for what's wrong or how you fixed it
@BasicBridge You couldn't even be bothered to explain what you've changed, why would an answer with such little effort put into it deserve an upvote?
its true syntax, please get me positive no negative for answering :( — mohammad reza ashouri 2 mins ago
hahahahahahhahahahahaha just perfectos
@PeeHaa Yes, that made me chuckle. Good stuff
@rdlowrey This is why they don't get sued: put.io/dmca
@PeeHaa You gotta love those iranian asm programmers...
user895378
16:38
@LeviMorrison I get it :) But there are enormous costs involved with responding to all the frivolous takedown notices. It's just a difficult position to be in.
@Leigh Ok,
user895378
The idea, though, is awesome.
> Hassle free torrenting in my butt
@Fabien Whatever floats your boat ;)
lol
16:39
Really, if you're gonna torrent what better place to do it than your butt?
s#the cloud#my butt#g
@webarto Greatest. Browser Plugin. Ever.
EVAH
The first interesting PHP question I've seen in a while:
1
Q: Decreasing memory usage for array and SplFixedArray

Pavel ŠtěrbaI was doing some benchmarks between array() and SplFixedArray() and I run into strange behaviour. At first, look at my simple test (it's actually just edited version from internet, sorry, I can't find original source now): function formatMemoryUsage($usage) { $unit = array(' B', 'kB', 'MB', '...

Don't let the first bit confuse you: the question isn't about the 'speed' of the benchmark results.
user1607528
I'm new to OOP in PHP,Let's say I initiated a one class outside of a another class and want to call the first class in constructor. How do I do it ?
user1607528
16:45
$mail = new PHPMailer;
class Email{
public function __construct($mail){
$this->mail = $mail;
}
@Muhammet You probably don't want to do that
user1607528
@PeeHaa how can I use the mailer class inside email class, can you show me with above example please ?
Not in the constructor you don't
Why do you need to do that in the constructor?
@Muhammet The best way is just instantiate a new instance of the mail class inside of Email when you need it
No it isn't "the best way"
16:50
Unless there is a specific reason why you cant
In my opinion it is.
And that's all people can offer here
@crypticツ The error message is actually correct and what you're trying to do there won't work - you can only set 'opcache.enable' to on in the ini file, not through ini_set.
No we don't do opinions here. Only tested facts
Also 'opcache.enable_cli' only make opcache enabled for the cli if 'opcache.enable' is also enabled.
@Muhammet What do you want to call of the phpmailer class?
@Danack then the documentation is wrong as it says PHP_INI_ALL
16:53
@Styphon Hidden dependencies is hardly the best way to do anything.
user1607528
@PeeHaa you mean why ?
@crypticツ PHP documentation wrong? HOW CAN THIS BE?
Also - there's some documentation?
@cspray creating a new instance as you need it is hidden? really?
@Danack Well CLI opcache is PHP_INI_SYSTEM, regular opcache is ALL
@Muhammet What method do you want to call inside the ctor?
user1607528
@PeeHaa I want to use send method so I can send emails
@Muhammet And you want to do that in the constructor?
@crypticツ Yep - it's possibly technically correct - you can disable opcache through the ini_set() but you can't enable it. I'll add a note.
user1607528
Probably not
user1607528
16:55
thanks
That's like cumming when you just started the foreplay ;)
@Danack oh I guess that makes sense, can't opcache in the middle but free to drop any opcaching done at anytime.
@Styphon If you're creating dependencies for a class in the constructor it is a hidden dependency. And almost always a code smell.
And virtually untestable
What you probably want is to have a method send in the Email class with the content $this->mail->send() or something like that
user1607528
@PeeHaa yes , i think the same. thanks
16:58
@cspray I never said place it in the constructor, I'd never advise doing anything like that
I said call it as you need it, i.e. in the function
That's still a hidden dependency
Room 11, come with a question and leave with 20.
@DaveRandom Can you approve an edit by user 38809 for the page edit.php.net/?project=PHP&perm=en/opcache.configuration.php please, as the file is locked and uneditable to me.
user895378
user image
2
heh
Leaving with more questions than entering is a good thing.
user895378
17:07
Hey @NikiC here's a suggestion for the PHP internals book section on the Symtable and array API ... You guys may want to add an array_init example that doesn't operate on return_value because it makes it seem like the MAKE_STD_ZVAL() isn't necessary with array_init ... May not be a big deal but it's a mistake I made at first.
user895378
Or maybe a comment like this prior to array_init to reinforce the concept:
user895378
/* We don't MAKE_STD_ZVAL() here because return_value is already a zval */
@LeviMorrison I'm going to answer that one… currently browsing a bit in zend_alloc.c…
user895378
This is the dumbest answer and I posted it two years ago when I first started using SO and didn't really know much about anything. I have no idea why people constantly upvote it. Makes me feel guilty.
17:23
Not instantly getting why it's so dumb?
user895378
@bwoebi Well it's not dumb. It's just really trivial. I don't understand why people massively upvote it.
-1 not enough jQuery — webarto 9 secs ago
user895378
\o/
@MadaraUchiha Done
Edit as needed
17:26
@rdlowrey because it just works?^^ I'm also getting upvotes on trivial answers…
@rdlowrey Isn't that most of SO stuff?
Half the reason I don't answer questions is because all the questions I 'could' answer are trivial.
user895378
I guess. Maybe I'm just looking at it the wrong way.
95% of them google'able. With an 80% chance google will return an SO answer.
@bwoebi Just tell them to use memory_get_usage() without true ^^ problem solved
@NikiC that'd be too easy :-D
By the way… by answering this, I also learn about the zend mm…
17:29
I'd have answered it as well, but a +50 bounty just didn't seem worth the effort...
@NikiC It's not because of the bounty…
facebook.com/lookback for you FB users.
17:42
@rdlowrey Were there any other examples of people having problems with Doctrine, or was it just Jimbo?
user895378
@Danack I think there was one other person who had a similar issue, but you'd probably just need to cruise through near the top of the closed issue list. to find it.
18:00
How do I find out if my server's PHP has dom_xml functionality on
ThW
ThW
extension_loaded('dom');
what do I do with that
Would appreciate if anyone could spare a few minutes to help with this php/javascript question – have had very little response so far. Thanks!

http://stackoverflow.com/questions/21457725/issue-outputting-php-array-of-links-to-jquery-backstretch
I'm happy to announce that next week I will be starting my next endeavour is as a Developer Advocate for Google! Looking forward to it! :-D
8
@Gordon ^^ You were right :-)
Ha!
18:06
@thW ??
@ircmaxell congratulations
thanks! :-D
now start advocating me as a developer :D
user895378
I was right too!
Yes, but you had inside knowledge :-P
18:08
How do I find out if my server's PHP has dom_xml functionality on
congratulations @ircmaxell
ThW
ThW
@benlevywebdesign it return true/false depending if the extension named dom is loaded. This extension contains the DOM functions/objects for XML traversing and manipulation.
my friend works at big G as an IT recruiter, but in Switzerland, so I guess you won't cross ways
where do it put it?
you never know, it's a big company, but not THAT big
ThW
ThW
18:09
@benlevywebdesign it is a PHP function call, so I would suggest a PHP script.
@ircmaxell Grats, man! What does a Developer Advocate do?
Hi everyone. :)
@ircmaxell Iiinteresting. Thanks.
ThW
ThW
@ircmaxell congratulations
18:14
@Jimbo Your example code from github.com/rdlowrey/Auryn/issues/29 has dissapeared - any chance of sending it to me?
yeah, it's a mix of community and external public speaking, with some development and the such
:-)
Is the DOM independent of the language it is used in or do I have to adapt it to the language I'm using it in? For example getElementsByTagName('channel')[0] works in JavaScript but the same code doesn't work in PHP.
ThW
ThW
@SineLaboreNihil the API is a defined standard
The implementation and of course the language depended syntax can be different
@ircmaxell what a bad ass job, i will take the tour at the new place :P
ThW
ThW
getElementsByTagName('channel')->item(0) should work in php
18:17
lol :-D
@ThW How come I can't access the first node of the nodeList in PHP then?
@ThW But getElementsByTagName('channel')[0] doesn't work in PHP
@PeeHaa There, it got merged with the canonical, happy? :P stackoverflow.com/a/21516022/871050
ThW
ThW
@SineLaboreNihil array dereferencing is not part of the API, but some JS syntax sugar
I thought it was the same code regardless of the language used.
@SineLaboreNihil It would depend on if the language lets you treat the collection returned by getElementsByTagName as an immediately indexible array.
18:20
@ThW Oh, ok, so accessing the array element positions is not defined in the DOM standard?
I forget if PHP permits that, and if it did, PHP didn't permit direct indexing of an array returned by a function until what, 5.4 or 5.5?
So if you're using an earlier version, that'd be a syntax error anyway.
@SineLaboreNihil They defined their own "collection" classes and added a certain set of methods to them to permit sane access in languages that make arrays a pain / to standardize things in their own way.
@ircmaxell congrats :)
@Charles So if at my local server I update my PHP version from 5.3.8 to 5.4 or 5.5. I should be able to access the array returned just like I do in JS?
ThW
ThW
@SineLaboreNihil getElementsByTagName() returns a node list. Node lists have an item() method
Node lists implement Traversable but imho not ArrayAccess (in PHP)
18:23
@ThW Oh, ok, I always thought of them as arrays, because I was able to access elements by suppying an index [i] in JavaScript, so I thought it was the same in PHP.
@SineLaboreNihil Maybe. I don't know, it's been a long time since I wrote DOM code in PHP. The PHP implementatino of DOMNodeList implements Traversable, so you'd at least be able to use it in foreach.
replying to another answer and thanking them
ThW
ThW
so foreach() is possible but not array syntax
Thank you both so much for clearing this up for me. :)
They don't teach you this in college. :D
Thanks everyone! Now time to fly! :-D Later!
ThW
ThW
18:26
iterator_to_array($dom->getElementsByTagName('channel'))[0] should work, but I would prefer $dom->getElementsByTagName('channel')->item(0) or better $xpath->evaluate('/channel')->item(0)
@ircmaxell I just read the big news. :) Congratulations. :)
@crypticツ lol at some point you're going to run out of rep to dv :P
@ThW XPath is what I'm building up to. I had some difficulties converting my simpleXML code to XPath+DOM code, because I needed to better understand how the DOM works, so I'm first converting my SimpleXML code to DOM and then adding the XPath. :) And I too prefer the second way, although thanks for the tip on the first one. Good to know. :)
that guy seriously needs a suspension
18:30
@CarrieKendall it's that same freaking guy, I basically have him bookmarked since I know he keeps needlessly bolding text with header markup and posting answers wrong. I may get my Marshall badge with him alone. =oP
@CarrieKendall When you down-vote that kind of question, it gets deleted and you get back rep. No point in down-voting for that situations though.
@Leri eh, he posts a lot of low quality answers along with the nonanswers
@ThW I mostly had dificulties trying to push elements of a nodeList into an array, by trying to iterate through them using [$i] thinking I can access them as array elements.
@Gordon when will this person be suspended/banned? They have had a ton of flags already and constantly having to edit their posts. stackoverflow.com/users/2165415/taztodgmail
ThW
ThW
18:34
well usually reading xml you want a list of nodes or singe values, lists you traverse using foreach, values can be used directly
@CarrieKendall edited!
ThW
ThW
converting the result directly to an array is unusual
@ThW I thought it would be like an array of objects. Frankly nobody at college mentioned that there is a nodeList in PHP or in DOM. This is just something I had to learn on my own, with your help of course. :)
@ThW But accessing it with ->item() produces the same result. :) And foreach works just as it would with an array of objects.
ThW
ThW
I could implement the ArrayAccess syntax into the FluentDOM classes ...
user924016
@ircmaxell congrats
18:43
Simple question here. I have if(empty($_SESSION['user'])) { at the top of my PHP page to prevent unauthorized access. I now have to append a simple access control per user, ergo I would need to add something to this code to restrict that appropriate users.

I am using simple numbers (1, 2, 3, etc) to define the user type.

$_SESSION['user'] returns the correct row as an array.

Anyone can direct me in the right direction?
@ThW What are FluentDOM classes?
@MadaraUchiha yay I can finally sleep now :D
Also mrongin room
ThW
ThW
@SineLaboreNihil FluentDOM is some small project, implementing the jQuery API for Traversing and Manipulation in PHP.
The new version has some extended DOM classes, too.
@ThW Is that your project?
@ircmaxell Very nice!
ThW
ThW
18:46
@SineLaboreNihil Yes
@ircmaxell gratz!
@deathtap Are you trying to give them different access levels based on the number user is assigned?
@Ocramius Am I being as blind as usual, or is there no documentation for doctrine-project.org/api/orm/2.4/… ?
@SineLaboreNihil Yep.
@ThW Is it available online to check out?
18:47
@SineLaboreNihil Essentially I am redirecting them to a different PHP page from the login (which works), but if you type in the URL directly after logging in, you can access that page.

For example, I log in and go to editor.php but type admin.php, it would allow me because I haven't restricted it.
@ThW Thanks. :)
@ThW that URL hurts my OCD
^^ me too
@deathtap I believe this question might hold the answer to what you're looking for: stackoverflow.com/questions/4400881/…
I must update my PHP for FluentDOM. I'm 0.0.2 versions off. :D
18:50
@SineLaboreNihil Thanks! I'll check it out.
@deathtap You're very welcome. :)
19:10
@ircmaxell congratulations!
@crypticツ what did he do?
@ircmaxell that was my guess :D Awesome!
@Gordon Keeps posting links to other SO answers as an answer, or replying to posts as answers, or putting big bold text using == to create headers just to get attention of OP.
^^ I can attest to that; we went on an editing spree one day, trying to fix the pudding he makes of every post.
@Gordon example of the header abuse which he keeps doing over and over stackoverflow.com/revisions/20476286/1
Can you leave him a note telling him to not do these things? He doesn't seem to be improving at all.
19:20
@crypticツ using giant text! is not an offense :/
Answering with links to other answers is though, isn't it?
@Gordon To me it's an obvious way to make their answer stand out on the page over other answers. Ok, it's not a valid enough reason to ban or anything, but the other issues should at least warrant something?
@ircmaxell just don't stop blogging now that you're at google.
@crypticツ The only way to stand out from other answers is to provide better answer not bolder... All I want to say is that, it simply does not work. :)
19:25
@ircmaxell Wow, grats! Sounds awesome.
@Leri of course, but you might as well have him post marquees =oP
@crypticツ its much more an issue that he kept duplicating existing answers. but that has been taken care of already, so no worries.
<h1><blink><marquee>I AM TAZTODGMAIL, HEAR ME ROAR</blink></h1></marquee>
You forgot <h1>
@DanLugg There's something wrong with me. The first thing I noticed was the inappropriately matched closing tags.
19:30
Thanks all!
@cspray That, my friend, is completely normal.
user924016
=]
@DanLugg Sadly blink is no longer widely supported :(
@NikiC Damn, you're right.
<marquee> is though ;-)
@ircmaxell so what products will you mainly work on? Glass? And what technologies?
19:36
@NikiC that's okay, when we have MySpace text generators!
my eyes!
user924016
lol
user924016
ROAOOAWR
hey if anyone is good with converting XML data to JSON with PHP and has a second, I could use some help on my question: stackoverflow.com/questions/21561475/… -- thanks for your time :)
@salathe thanks for putting katy perry in my head
19:39
1 message moved to /bin/gif
@salathe That reminds, when you going to make an official Room 11 logo? Mainly to be used for the Github org
@PeeHaa how come I can never move messages to /bin/gif? It never shows up on list for me.
@gordon the apps team. That's what I know right now ;-)
user895378
@DaveRandom Interesting ... looks like node uses the same terrible value-based approach for assigning TLS methods that I'm replacing for 5.6. Flags FTW!
@crypticツ the logo should have the main man's pic there.. but he's gone.. how sad. T-T
@ircmaxell g-apps?
@ircmaxell oh, so you could be working on the app engine for php?
19:48
Gah… who has locked the /bin/gif… My eyes!
@salathe :x #^
Not sure.
Will let you know when I know :-)
@crypticツ Strange it should just pop up when typing in gif
@PeeHaa only when the person has the ability to move messages into there
my eyyyyes!!!!! (yay, finally I could bin it!)
hey there's a jpg in the gif bin :(
19:54
booooooooo
fixed @crypticツ ?
and a video link, gosh
@PeeHaa now it does!
\o/
@salathe ftfy
@bwoebi it's not peehaaaaaa's bin!
19:57
@salathe I didn't change that.
it's still not
20:14
any of you doing interviews with candidates and willing to reveal whether you take notes during the interview?
@ircmaxell Congrats on google. I figured it was when you mentioned you couldn't say. I read about some clauses they have for people they offer jobs not long ago :) Or maybe that's a common thing, who knows.
@PeeHaa dv, cv or flag?
all of the above
@Leri php.net/debug_backtrace - so we just are printing it. So I expect print to be in either beginning or in the end, not in the middle
@andho yep, this makes sense
20:27
@zerkms you expected consistent naming? from PHP? Really? Bwahahahahahaaa! :D
@Gordon I know )
@crypticツ thanks for the spam flag rainbow kittycat (or whatever your new avatar is). handled.
@Gordon Rainbow Dash!
continue;
and congrats to @ircmaxell from me as well
20:31
@crypticツ ah ok. So from now on, I'll call you My Little Pony?
20:42
guys, i need opinions regarding hosting a PHP system on azure, anybody here who has experience using it?
@Gordon Yes. We always take notes during the interview.
We generally have 3 people in the interview with all 3 taking notes.
@Gordon Rainbow is good =o)
@rdlowrey That is terrible. Wow.
user895378
@LeviMorrison Yeah you only have the option of supporting everything from SSLv3 through TLSv1.2 or only one specific individual protocol out of the group.
user895378
Not very well thought out.
user895378
20:52
It's quite useful to say, "TLS1, TLSv1.1 and TLSv1.2" (or something)
Hmm, I have trip monitors. I want the far left to have my Launcher but apps to open from my middle monitor. Any ideas guys? (Ubuntu).
-2
Q: Need a programmer for PHP scritp

user2073304Need a programmer for website php script automated contact me only if you are expert in programming budget is $500


« first day (1207 days earlier)      last day (3967 days later) »