« first day (2011 days earlier)      last day (3163 days later) » 

09:00
@PaulCrovella Learning how other languages do things can give a wider perspective over what are good solutions and what are not
@JoeWatkins I know. So that means function fn() implements Foo would then result in new class extends Closure implements Foo { function fn() {}, function __invoke( return $this->fn() ) }
Despite not necessarily liking it very much, I know how Java does things, how PHP does things, how JavaScript does things, how Common Lisp does things, etc
@JoeWatkins its not about being a object, but being about a concrete object, namely closure. if a closure implementing a functional interface would still be a closure under the hood I'd be fine with it, I guess.
@Gordon well, sort of
(reflect on Closure)
a functional interface doesn't have to be implemented this way, you just have the option, but the consumer of the interface doesn't know how you implemented it and shouldn't care
@MadaraUchiha I know that magically adding methods is weird, and it's (thankfully) irrelevant how Java or Javascript do pretty much anything... (and Lisp is cute if you can figure out what to do with it)
09:05
Right, now actually lunch :D
!!docs RecursiveTreeIterator
stupid jeeves
> Allows iterating over a RecursiveIterator to generate an ASCII graphic tree.
because we need this...
I use that every morning ...
Well I'm going to start using it now I know I can!
@JoeWatkins yes, I understand. Still feels a bit weird to have to the same syntax for two things now
I'm not sure what two things you mean ?
not sure if referring to the declaration, or invocation ...
09:13
When I login my website (offline, on WampServer) in Chrome, and close the browser without logout, and open it again, the session is not destroyed. While I do the same in other browsers, session is destroyed. How's it possible? Is it using previously saved cookie?
it is magical, but it's a single piece of well reasoned magic, with good benefits, I think ...
it's not more magical than an anonymous class, or anonymous function, not really ... just magical in the other direction, where we are giving stuff names rather than taking them away ...
hard to explain. right now a lambda is a very certain object to me. With a very certain usage. When it starts implementing a method, I am not really using it like this any more.
@JoeWatkins under RFC Impact > To Existing Extensions: "Extensions will be able to provide implementations of functional interfaces as part of their API." - they already can provide implementations of those interfaces.. did you mean instead "Extensions will be able to provide functional implementations of interfaces as part of their API."?
yeah ... we are exporting api basically ...
or phrased differently: if I have a type hinted consumer, it cannot use the lambda as a lambda anymore because the functional interface does not include the lambda interface. know what I mean? its not necessarily bad though, just weird in the first moment
09:17
show me code
I'm not sure how you type hinted for the lamda in the consumer, if you mean you hinted for Closure, then that's not broken ...
@JoeWatkins me?
@JoeWatkins Like this class Consumer { function do(IFoo foo) { foo->theMethod() } }
I'll assume there is more code/explanation ?
(that's not a hint for a lamda)
so when I now pass an interfaced lambda, the consumer will only ever be able to use it as a regular object, but not as a lambda
if this and intersection types pass I expect to see a lot of type declarations like IFoo & Closure because it's probably more common that people want to enforce a closure's signature
09:20
but you couldn't have passed a lamda there before
it couldn't have implemented an interface before, so I'm not sure what you mean ?
hii everyone
I just wanna ask, my flags are pending since very long and no action are taken on it yet. I read a post where it says that in chatroom I should ask the moderators so they can do that. Please can you guys help me with this. :)
I'm not really sure about that ...
$foo() is not very descriptive ... write a few lines of it and try to reason about what the code does given only context and good variable names ...
->doThing()
@JoeWatkins $foo->call() is more descriptive somehow?
09:23
this provides actually useful context ...
write a few lines of it ... if ($thing()) $other() ... what is that code doing ?
I have to lookup the interfaces ... that's terrible ...
Here is the link, that you can check @DaveRandom, @JoeWatkins

http://stackoverflow.com/questions/36591650/how-to-convert-directly-lead-to-quotation-in-odoo-8
don't do that
@DaveRandom, thanks for the link. I'll surely take a look at it
Also that is a terrible question. It's not even a question, in fact, it's a request for code in some very specific framework/platform that I know nothing about.
09:26
@JoeWatkins its really about that only. If I have a lambda implement an interface, then any consumer of that interface will not be able to use the lambda as a lambda, e.g. use bind or invoke. It's really more like an anonymous class then. Hence "two things". But obviously, one could define the lambda and use it in some other consumer as well, so its not necessarily wrong.
no no
they can
I would be thankful if somebody answers it: stackoverflow.com/questions/36688006/…
it's a closure, you can do with it what you can do with closures, only now it has a formal useful type ... and an interface ...
@Gordon But the consumer did not ask for a lambda, it asked for an object implementing an interface. The interface does not include bindTo() etc. The lambda could still be passed to a thing that expects a lambda
@DaveRandom, the user is seeking for us to write or suggest him an answer, which I guess SO is not about
09:28
@Ms.Nehal oic. In that case, see also gist.github.com/1689430
@DaveRandom yes, thats what I mean. In that specific consumer, it wouldnt be allowed. But I could obviously pass it to another consumer not requiring the interface. fair enough.
@Ms.Nehal they're not moderators, moderators' names appear in blue
@Gordon no it would be allowed
it would be an assumption on the part of the consumer to get an interface and assume it's a closure, a brand new, pretty non-sensical assumption ...
I must be misunderstand you :s
Only with some kind of manual analysis of the passed object to verify that it actually is a closure though
or intersection types
09:30
cv-pls , http://stackoverflow.com/questions/36591650/how-to-convert-directly-lead-to-quotation-in-odoo-8 ,

is that ok @DaveRandom
@JoeWatkins it would be technically possible in PHP because PHP doesn't prevent calling methods not in the interface (unfortunately). It would still be wrong by contract though
I have a feeling @Gordon that you are suffering from some kind of Monday a.m. brain fart and will suddenly realise at some point, because this seems like an odd thing for you to be raising
ok @PaulCrovella, thanks for letting me know
dude, it seriously does ... it's also monday for me though, so might be both ...
09:31
Either that or some kind of Monday a.m. communication breakdown
yo @Jimbo
@DaveRandom huh? why is that odd to raise?
@Jimbo \o
@Gordon Because it's almost like you saying "I have a class that implements two interfaces, if I type hint for one interface I can't know that it has methods from the other".
Which is obvious, because that's how interfaces work and, indeed, what they are for
09:33
@JoeWatkins can you please verify whether master had been merged into 7.0?
what ?
The only difference is that with this RFC, there's no way to hint for a thing that is both a closure and implements IFoo because there's no intermediate class
@DaveRandom the point I am trying to make is that I find it mildly weird to use the lambda syntax to create a lambda when the resulting code is never used like a lambda by limitation through the consumer's typehint
@JoeWatkins github.com/php/php-src/commits/PHP-7.0 history's including master commits
note that I am not saying I am against it
09:34
in 7.0 branch
@Gordon I actually view this from the other side, i.e. it gives a way to create delegate types so you can hint for a closure with the correct signature. I can see what you mean I guess, but I also can't see myself using it like that
oh I can see that @Gordon
@JoeWatkins Okay, wrote a SMS to someone with push -f rights
09:36
@Ms.Nehal winner, ty :-)
@bwoebi I'm still looking at git ... I don't see a big merge ?
@JoeWatkins there's no merge commit btw.
these are fast-forward
it's just containing all the commits from master in 7.0
yeah I see that, same history :s
who did that ?
oh god, it wasn't me was it ?
09:38
I'm not sure whether it's my fault
seems like it's gonna rain here...
super glad it happened to someone else :D
sorry ...
> git? I know how to use that! - nobody, ever
I've typed git pull origin master (accidentally), but ctrl+c'ed … looks like my SIGINT was too late.
09:40
so anything missing from this rfc, or discussion time ?
shit.
1380a6c HEAD@{0}: pull --ff origin master: Fast-forward
@JoeWatkins I am torn between cool shit and unneeded because easy enough to achieve with anon classes
Indeed, the pull went through
ARGHS
shit happens bob, someone will fix it and we'll move on ...
someone might tweet about it ... because it's funny ...
@Gordon missing vital difference ...
anon classes have no lexical scope
@JoeWatkins I would add a note saying "this would also allow people to create interfaces to hint for callables with a specific signature", because it took me a while to see the usefulness of it and for me, that would be the most useful thing I could do with it (or at least, the most common usage)
Anonymous
09:43
@JoeWatkins haha
@JoeWatkins see, I'm even more talented than you ;-D
@JoeWatkins I'd like there to be a way to keep track globally of the number of times people end up saying "Where the fuck did that method come from?"... future scope maybe
at least you realised ... I think someone had to tell me ...
@JoeWatkins I did because I wondered why it accepted my commit :x
I forgot Saturday to push a commit to PHP-7.0
only merged into master
wanted to push it, but wanted to check whether all is okay
@DaveRandom I kinda want to steer clear of that ... you can type hint a closure, but the type hint could be implemented by a non closure ... there's no way to tell them apart right now ...
and if I have to delay another thing because of fucking types, I'll kill myself ...
09:45
@JoeWatkins oh. indeed.
I think I am game
of course you are ...
:)
that also somewhat mitigates my comments about not being able to use it like a lambda
there are two nullable rfc competing ...
what are we doing ...
Fil
Fil
hello
@bwoebi now I can say "happens to the best of us" and not just be talking about myself (like a dick) :)
09:49
@JoeWatkins hehehehe
@JoeWatkins can I compose functional interfaces into larger interfaces?
what do you mean by that ?
(probably not)
because they existed for a couple of days, and I don't remember doing anything like that, although i may have done, by accident, or it might be doable, if I could just understand what you mean :D
e.g. could I do interfaces ICallable { pubfn __invoke }, IFoo extends ICallable { pubfn foo() } and then $fn = function() implements IFoo
@JoeWatkins No I mean that if you want to hint for a callback you can create interface FooCallback { function callFooCallback(string $x, int $y, Bar $z) : bool; } and then pass a closure implementing that interface. You could also pass an object implementing that interface, but that's immaterial, the caller can implement the function signature however they want, and indeed some might choose to do so, it may work well when consuming some evented model
> the type hint could be implemented by a non closure
^ irrelevant, it's an interface
The receiver doesn't need to know, and shouldn't care, how it was implemented
@Gordon no, more than one method
@DaveRandom imagine symfony puts out the interface IFoo, and consumes IFoo in one of their API methods ... they don't implement the interface at all themselves, which has to be pretty normal ...
09:54
Does anyone know of a library that decodes JSON into a specific class rather than stdClass? - I wrote a quick hack to do it, but figured I can't be the only person wanting this, and there's probably a maintained version out there.
they aren't hinting for a closure are they
OK... and?
so if we say "you can hint for closures now" ... people are going to rightly point out that you can't hint for anything more than you could hint for before ...
I think it should be mentioned but I don't know how to word it ...
ahh ok I see what you mean, it can be used like that but you don't want to advertise that as a primary purpose of the feature
yeah
might be best to steer clear of it ... it's an added advantage, if you choose to adopt it as convention ...
but it involves making strange, brand new assumptions ...
09:57
@JoeWatkins Maybe keep it back as a card to play if people don't get it as it stands
Yay politics!
if people don't get it as it stands confuse them further?
but then I have no solution to the problem of forcing an interface to be a function that isn't disgusting ...
hey, how can I use $_FILES in this code: var filename = $('#fileidname').val();
var image = $('#imageToUpload').val();
var desc = $('#descriptionArea').val();
var username = $('#userSNameId').val();
var cmt = $('#commentArea').val();$('#execData').load('ExecuteData.php', {"filename" : filename, "description" : desc, "comment" : cmt, 'Image": ?}); ?
function (function Ifoo $foo) {}
09:58
@Leigh like serialize/unserialize or specifying class on json_decode?
and would conflict with nicer solutions that we may or may not get
@JoeWatkins I don't see why this is necessary
6 mins ago, by DaveRandom
The receiver doesn't need to know, and shouldn't care, how it was implemented
@Gordon thanks, I'll take a look, @SergeyTelshevsky the latter
if you want to consume it as a closure, and say "you can type hint for a closure of a specific type now", hinting for the interface is not enough
It could be a function, or an object, or a model made from string, sellotape and dry pasta, the consumer shouldn't care because it exposes the correct interface
@JoeWatkins Yes I get that and I agree
It should be referred to as a "stop-gap" solution, if at all
10:00
I rather hope they take the time to get it ... it does take a bit of time ...
you know what I'm supposed to be working on right now ... this ... I <3 my job ...
should I or should I not mention the type hinting for closures thing initially ? I need more than one response, please ... go ...
depends, do you want people more or less confused about it?
less
that's a no ...
more ?
(I just used people skills, I think)
I am confused
how would I typehint for a closure with an interface?!
you can't ... chris thinks it worth mentioning that closures can have a formal type now ...
I can do Closure $foo or IFoo $foo, but not both.
10:05
yeah
@JoeWatkins for less that's a no, correct. plus you should rename it to something like "functional implementations of interfaces" as this isn't a new thing for interfaces, but for implementing them
terminology is borrowed actually
I'm almost scared to say it, but this is a thing in Java 8, they do it with proper lamdas, but more or less the same thing ...
and the tighter you stick to it the more of this conversation you should expect.. just across internals and reddit etc.
I super hate this bit ... I wish phil were here ...
he's busy, having a life :D
how dare he!
10:08
ikr
@bwoebi What did you do to php-7.0?
merged master into it @NikiC
@NikiC fast-forward master in…
johannes is fixing it…
duh
10:09
happens to the best of us ... or me and bob ...
thankfully someone killed the mail delivery
stackoverflow.com/questions/36690041/… how the blip is this getting up voted?!
I don't fancy getting a thousand new mails on a monday morning :P
lol
totally forgot about the mails lol
good that I'm not subscribed :-D
reviewing by hand on the interface^^
@JoeWatkins @NikiC fixed
I am, but I only go in that folder on the darkest, loneliest nights ...
10:11
you can work on it again :-D
@Epodax don't expect sane behavior from people who follow the codeigniter tag
@bwoebi I only got ten, thankfully
@PaulCrovella Apparently not, it almost makes me want to cry.
want to compress images of website size to reduce to a size of a col-md -6 with a min-height of 600.. if any images of height and width greater than this..?
@Epodax put the tag on your ignore list and set your preferences to hide those questions completely instead of just graying them out.. helps with a lot of tags
10:15
I tried imagick and many but all does not give the right result for image dimension of 600x600 thumbnail....so guys please help me do this..
@astrosixer compressing and resizing are two different things
...but tinypng.com
That may be my favourite ever free tool related to frontend stuffz
@Gordon only thing i care is want to display the image without distortion or any of such sort of things..but with dimension of 600x600 as thumbnail
@DaveRandom that "Panda says" stuff is a red flag
@PaulCrovella It's honestly brilliant
10:20
@Gordon It's pretty heavyweight for my needs, don't think I really need a bunch of doctrine and 4-5 other libs to put json into a couple of value objects for configuration data :P
@Leigh but how will you know if it's 13???
@DaveRandom what about size greater than 5 mb?
@Leigh it is heavyweight. and also not particularly fast. It aims to be a java jackson clone.
@astrosixer ...why are you dealing with images > 5MB?
I have videos that are smaller than that
I have images around 500MB
10:23
With a high proportion of flesh tones, presumably
@PaulCrovella do you upload these to websites?
I did it ... I'm now going to hide ...
RFC == Run For Cover
9
@Leigh you could also try stackoverflow.com/questions/3243900/…… but that's … ugly.
@PaulCrovella I once found an image having the size.... like... 9.8 GiB
@Gordon I'll stick with what I already wrote, since it does what I need right now, thanks again though
10:25
@DaveRandom not terribly often with the flesh tones, but sometimes... I'd upload them in full if huge amounts of disk space got a couple orders of magnitude cheaper
@DaveRandom cazzette?
@Saitama high resolution scan of a large area (e.g. large format film), stitch or other composite, I'm guessing
> P.S. This happens about once a year, could be nice if somebody with some
git scripting skills could provide a script to prevent pushing
revisions, which exist in a higher branch, to a lower branch.
didn't know that /cc @bwoebi
@JoeWatkins well, yeah, you weren't the first one ;-)
Hey I dont have that much experience in working with classes, I had a question which seems so simple but I cant figure it out. Lets say I have a database connection in a seperate file, and it's in the variable $mysqli. I want to use this in every function in my class(of course without putting the whole database connection hard coded in every function seperately) but I cant seem to figure out how to do this. I cant just require the database connection file in the class. How can I do this?
10:29
I knew that but didn't know it was a regular, as regular as yearly, thing ...
@PaulCrovella It's bandwidth I'm more bothered about. In any case I'll bet a sizable amount of nothing that @astrosixer does not actually need to worry about this and could simply impose the same 5MB limit on images accepted by his/her app
@PaulCrovella it was a satellite scan of the farms in US, which was given as the datasets, in a challenge...
@JoeWatkins it's rather an average one year
people who deal in images that size also know how to shrink them for upload to web
yeah, still pretty high average though ...
unless a bunch of us got drunk and decided to replace every version of php with a version of ruby ...
did that happen ?
we should make that happen ...
10:30
not that I'm aware of :-D
@JoeWatkins Don't summon the demons!
@Gordon no loady for me for some reason
if it happens now, it's not my fault ...
@DaveRandom you got spotify?
10:33
not on work machine
@Saitama yeah, a big stitch. stuff can get difficult to work with at those sizes, I'm sure it was a fun challenge
it may be that someone has blocked soundcloud for no reason
should work via webplayer
10:37
@Jeeves I think Jeeves should just insert the tweet without the mention so it gets autoboxed
hey everyone, does anyone here ever used phonegap push notifications before? i´ve been seeing some tutorials but i´m trying to understand if there is any "special needs" if the info that we want to push is coming from server
or if there is any key or something...
I wonder what the thought process was for the first person to discover cow milk.
6
obvious isn't it ?
@Gordon works, ty
they would have seen the cow feeding their young, and they would know about mammalian anatomy ... because they are one ...
10:44
o/
@JoeWatkins I thought you were gonna go in a very different direction with that.
@Fabor I often think that about beer. I mean I can see how someone may have accidentally created it, and I can see how someone would get drunk and think "I'll do that again", but I really don't understand how someone would have their first sip of some beer that was created accidentally (which would presumably have been disgusting) and think "that was nice, I'll have some more of that"
"Imma suck that. Oh shit milk! Bonus!"
Ekn
Ekn
lol
lol
that was probably it ...
Anonymous
10:45
user image
5
@DaveRandom lol
the beer thing, or bad cheese ...
this I don't get ...
@JoeWatkins I would need to be pretty confident that it was milk.
@PaulCrovella It was ;-)
@Fabor that's kinda all it can produce, anything that comes from mammary glands is by definition milk, a fatty protein rich substance suspended in water, that's milk ...
also, it would actually be pretty gross coming out of a cow
10:47
Yeah we know that now. But back then?
so yeah, pretty brave even if they knew ...
I would assume they did, we were farming these animals, intimate details of their life cycles were known ... and obviously comparable to us, you could make that mistake, if it were a mistake and be forgiven for it ...
it's not such a leap ... but it would have actually been horrible ...
So cow milk came after farming?
yeah I assume so, we herded them for meat at first I guess
how would you milk a non domesticated cow ?
they were beasts of burden at first.. they're not terribly efficient as meat
yeah and that
we selected for these properties ...
10:52
ಠ_ಠ <-- The look of the first guy to walk in on the first guy to milk a cow.
"I'm next, right?"
they definitely had a go
@DaveRandom my client wants to create a portfolio in which he need not present the entire site only he wants to put the website design image inside the body tag so that it will fit the entire page like web page. This image may be of large as 10 mb occassionally...
reaally ?
i canot do this everyday
mysql shows error "No connection could be made because the target machine actively refused it."
when i delete ib_logfiles error go away but it come after some days[3,4,2,..random]
@astrosixer This is... a bit of a weird thing to do, tbh. People generally use PSDs for mock-ups.
11:07
i don't want to go and delete this 2 files every time.gross ..do you know how to avoid keep getting this error again and again
The problem with generating thumbnails from very large images is that it requires a lot of RAM on the server @astrosixer
@DaveRandom try sketchapp.com or invisionapp.com for alternatives to the psd lock-in
@DaveRandom anyway i have to do this... the problem is need a thumbnail of the same image for the inner page should have dimension of 600x600 so that width of the image should fit and the length not necessarily fit..if half it will do...
@Gordon I would, but (thankfully) I don't do a lot of front end things. At worst, people give me finished static HTML and I dynamically generate bits of it
@DaveRandom hmm is this relative to my problem?
11:12
Yes. You are deleting your innodb log files to solve a problem, understanding what they are and what a good way to configure them would be a good place to start
I think mail servers are still down ...
My guess is that the real problem is filling a disk quota, but start by understanding what you are filling it with and where you can trim it down a bit
@JoeWatkins no hatemail yet?
none, kinda disappointed ...
Look at the mysql error logs and see what it complains about when it refuses a connection
11:15
thanks @DaveRandom next time i will do it ..
Would a fast snail be fast for a snail or an actual fast snail?
@NikiC you mean uopz, not apcu, I guess?
@Fabor Either way, I bet someone would corporate brand it as a "fail"
:P
@bwoebi err, yes, sorry
thanks for the correction @Joe
11:26
thanks for thinking of that before I did ... I was just drafting an email about stacking the handlers and xdebug, but didn't even think about uopz ...
good catch :)
@JoeWatkins the generics RFC apparently got discovered by $people. might distract from yours
I was excited at first too ...
there is still no patch ...
Hey I dont have that much experience in working with classes, I had a question which seems so simple but I cant figure it out. Lets say I have a database connection in a seperate file, and it's in the variable $mysqli. I want to use this in every function in my class(of course without putting the whole database connection hard coded in every function seperately) but I cant seem to figure out how to do this. I cant just require the database connection file in the class. How can I do this?
that's the difficult part ... writing a bunch of text about how a thing should work, with no idea how you are going to actually make that thing work is not a good use of time ... if you ask me ... which you didn't ...
@JoeWatkins yeah, this is the kind of rfc that's nearly useless without a patch
way too much depends on implementation there
and feasibility of implementation
11:37
@JoeWatkins didn't you just describe every product manager ever?
yeah, I think vanishingly few rfcs can be seriously considered without a patch, but sometimes it's a burning need ...
@Loko The basic thing you are talking about is known as "dependency injection" (DI). It's a difficult thing to google and find good information on, and you will also come across things called "dependency injection containers" (DICs) - you are not interested in these for the moment
@PaulCrovella hah, probably
I'll write a very specific example for your question @Loko, one moment
@DaveRandom ok thanks
11:41
@JoeWatkins I fixed the "Compiler Error 4" example in the Functional Interfaces RFC, so it now has the full code.
@salathe (bow)
@JoeWatkins FYI (totally safe for work)
that would literally have been my last guess, I would have been making it as a head in a jar, sometime in the year 3000 ... my friends would be a giant frog, and a stick insect from ... well you get my point ...
thanks
No worries.
11:47
I write "better" and "best" in there, but those are not absolute. Sometimes you want function arguments, and sometimes you want something that is injected into the constructor and kept in an instance property. It depends on the specific use case.
But for something like a database connection, you generally want a single shared instance throughout the application, which means that in general whenever you create an object that needs a database connection, you pass it the database instance at that time and then you can just forget about it
@DaveRandom While you were busy writing this, I googled it myself and I just used the same you did in my __construct:
public function __construct(mysqli $mysqli)
{
$this->mysqli = $mysqli;
}

But this is not working for me. I cant use the variable $mysqli in the functions
@Loko Properties are referred to with the $this-> prefix
@DaveRandom Aso $this->mysqli->prepare should work?
Yes it should, as long as $this->mysqli contains an object with a member called prepare()
11:52
@DaveRandom Also regarding the best practice for database connection, I am using the connection variable to execute queries but it wont remember the variable everywhere, thats why I'm using this. Is this wrong?
@Loko read this section of this page: php.net/manual/en/…
0
Q: subscriber is not working properly using ajax

Waqas_aamerIn my footer i have a subscriber form in which any user can subscribe to website. Form is <form id="newsletter-signup" action="?action=signup" method="post"> <input type="email" name="email" id="email" placeholder="Email" required/> <input type="submit" id="signup-button" value="" /> </...

In fact, read the first few chapters of the OOP book in the manual @Loko, and don't worry that you won't get most of it at first, just keep playing with it and re-reading it and eventually it will fall into place.
Literally no-one gets OOP at first, and anyone who tells you otherwise is a big fat liar with their pants on fire
it's why we don't wear pants anymore
@DaveRandom Ok I think I get it. I basically just use the variable I declared the class of the database connection function and then run that globally?
11:56
@Loko Ummm... can you reword this? I don't understand that sentence :-P
@DaveRandom Yeah after reading it myself, I didnt get it. Wait
At the entry point of your application, or somewhere near it (e.g. index.php) you do $mysqli = new mysqli(...), and you just pass that variable around as arguments to functions/class methods/constructors
@DaveRandom if my database connection function is in the class Foo, I would use: $foo= new Foo;
And then I can use:
Foo->Database_connection();

Globally?
I mean $foo->Database_connection();
@Loko Sort of, yeh. You pass $foo around... so basically there should never be more than one place in your code where new mysqli() is called, and you should only reach that place in your code once.
Raj
Raj
any one knows monthly 22000 searches of any keyword is sufficient for traffic on site
11:59
@DaveRandom Yeah I get that but what if I need the variable that the Database_connection would return to execute queries everywhere in my project?

« first day (2011 days earlier)      last day (3163 days later) »