« first day (1616 days earlier)      last day (3347 days later) » 

9:01 AM
@Patrick is there an easy way to compare value to an entire array in php?
if (1 == (any value inside array)) { do this}
 
please don't randomly ping me
 
i handle front-hand and i work in PhpStorm .. its awesome to work in it we use Vagrant and so working with team is much easier than ever before
 
why
whatever dude, anyone else know?
 
its rude
 
9:02 AM
@tereško I am using Mamp and sublime now...and if i used echo to print some some..it does not print at all..i already setup project path in Mamp config but it does not ech..do you have any idea
 
@Patrick it's not so expensive if you use IDEA and just add the plugins for php, python, etc. - you don't need separate purchases of phpstorm, and all that.
 
anyone know this:
is there an easy way to compare value to an entire array in php?
if (1 == (any value inside array)) { do this}
 
@NullPoiиteя I am dabbling with some go and python at the moment
 
moin
 
9:03 AM
@Patrick .
 
@DaveRandom good morning
 
@PaulCrovella 200 + 100 per upgrade?
@DaveRandom @DaveRandom @DaveRandom :)
 
@PaulCrovella or if you have a php.net account :>
 
@Swap-IOS-Android probably the webserver is misconfigured
 
IT'S THE END OF THE WORLD!!!!!!!! oh wait no, it's just an eclipse
 
9:05 AM
@tereško yaa i guess..on stack over flow i saw and i have to add this to config AddType application/x-httpd-php .html .htm
 
too much fog here...
 
thats why i don't like web technologies
 
@Swap-IOS-Android that's only for html files
you should make files with .php
 
@Swap-IOS-Android not really the web's fault if you use mamp ;)
 
is there an easy way to compare value to an entire array in php?
if (1 == (any value inside array)) { do this}
 
9:07 AM
@johnc. if you put your question into google the first result is the doc of the function you want...
 
@Swap-IOS-Android "I don't understand them so I don't like them"
 
so should i create another php file which talk to html page?
 
thanks buddy
 
yup, way to go
 
array_walk ?
 
9:07 AM
@FlorianMargaine i dont understand you?
sorry
 
nvm, found it
in_array :D
 
@DaveRandom in 38 minutes here ..
 
@Patrick Totally worth while, and better than the $100 + $50/60 per upgrade for each of the lang-specific IDEs that are based on it anyway. If you work in multiple languages it's great.
 
@PaulCrovella had a quick look, but it's too crowded for me. Even just all those buttons on the ui... Seems like a downgrade from sublime :(
I really just want to write code with my editor (but I don't mind if it helps me do that)
 
@DaveRandom I am sure there is a plugin for eclipse that could provoke the end of the world though
2
 
9:15 AM
@Patrick Every tool takes learning and getting used to. This one has been worth it to me. There's a free 30 day trial if you ever want to give it a serious go, but I get that some people are just averse to IDEs. Vim is often enough.
hell, I still remap all my caps-lock keys to esc because of vim
 
Good mooning :)
(I made an eclipse pun!..)
 
We're talking about phpstorm though
 
Haven't got enough sleep, so here goes stupidity: is there a function in php to array_shift(); an element by key?
array('foo' => 'bar', 'goo' => 'dar');
$bar = array_*('foo');
?
 
@SergeyTelshevsky array_splice() is closest, that will make $bar = array('foo' => 'bar');
 
or unset($arr[$key]) if you don't mind the value
 
9:24 AM
@tereško i manage to run php in html by changing apache server config...
thanks for help all you gues
guys
 
was looking at it, so.. probably the best way is

$bar = $arr['foo'];
unset($arr['foo']);
 
@salathe How is the eclipse up north?
 
Okay, I see it again, variance is damn hard 3v4l.org/prQLR
 
@Danack Cloudy :(
@SergeyTelshevsky If you don't want/need a function, yes do that.
 
Cloud? In scotland?
 
9:27 AM
@salathe no I just thought that there should be an internal function for this situation, like array_extract($needle, $haystack);
 
@Gordon I actually lol'd
 
this is a basic question
how can i insert values into an array as a for loop
similar to java...
array[0] = "whatever string"
how do i do that in php?
 
@johnc. This is the PHP room, not BASIC #friday
 
basic as in simple :P
 
@DaveRandom laugh out louded?
 
9:30 AM
@johnc. Precisely the same as you would in Java. PHP also has $arr[] = 'value'; syntax, which appends a value to the array at the next numerical index
 
ok let me try
 
@johnc. next time start with that "try" thing
 
thanks @DaveRandom !
 
$arr = [];
for ($i = 0; $i < 5; $i++) {
    $arr[] = $i;
}
var_dump($arr); // array(0, 1, 2, 3, 4)
 
thank you man.. you are a great person
 
9:32 AM
@johnc. if you were doing the above operation you could also use array_fill()
 
posted on March 20, 2015 by kbironneau

/* by matt */

 
@bwoebi seems like you should be able to relax requirements in a callable only for one level, if it goes deeper (anon function passed to asd()) you'll have some classical Generics-variance problems 3v4l.org/Be4Ma
 
hmm intersting
how do you make an if statement backwards, like if not this is true
i'm using the in_array function
 
@FlorianMargaine :D
 
if NOT TRUE (in_array(whatever,whatever))
 
9:36 AM
@nikita2206 My coffee is still kicking in "But now that we relaxed requirement in this anon function, asd() will have to pass a function with relaxed req. too" why would that be a problem?
 
@johnc. Again, exactly the same as Java ;-)
! is the logical negation operator
 
yeah i tried putting that in front i got an error
 
if (!in_array(...))
 
oh
i put it on outside
php is driving me crazy dude
 
you need to go through a basic php tutorial, like this one: github.com/PeeHaa/php-net-tutorial
 
9:37 AM
i dont really have enough time to learn all the basics, i just know how to do stuff in java and i am searching online how to do it in php :P
 
PHP is identical to Java in many ways, syntactically anyway
 
yeah thats what ive been noticing, thank god
 
The only real differences to a beginner are dynamic typing and $ in front of vars and -> for object member access and :: for class member access
 
i just cant debug at all in netbeans which is making hings very difficult :P
 
@Danack the code I posted, if callable sign. would be implemented in php already, it would not work, because in the body of asd() it would try to call a $cb and pass it a function with signature callable(B), but we called asd() first, we passed it anon function that expects as an argument callable(A). So at this point we basically try to pass A to B, where A is a parent of B, which is incorrect
 
9:39 AM
@johnc. Then you have netbeans set up wrong, it has full support for PHP (although I don't know if anyone here actually uses it)
 
yeah probably
 
At some point covariance becomes contravariance
'some point' === more than 1 level of nesting
 
@nikita2206 be right back - going to read msdn.microsoft.com/en-us/library/dd799517%28v=vs.110%29.aspx
 
is there something in php to jump to the top of the loop?
 
@johnc. what is it in java?
 
9:41 AM
exit a nested loop and jump
i think its exit
 
@nikita2206 $cba is an appropriate name for that variable, given that it's friday
 
break
 
@johnc. you can pass a number to break and continue for multiple levels
 
do the same as in java
 
9:41 AM
ok
 
Does Java have the continue keyword? It's such a long time since I had to write any I've forgotten a lot of it (thankfully)
 
If you want to break out of one loop you write break;, if you want to break out of two loops you write break 2; etc
 
ok cool thanks dude
 
@DaveRandom everyday I learn some odd english abbreviations :D
 
@DaveRandom lol, java is bad, but not so bad as to have no continue keyword ^^
 
9:42 AM
it may Dave.. i forget
 
@NikiC I prefer labels tbh
 
@NikiC I just seem to remember working with some C-esque language at some point that used next instead, maybe I just dreamed it
 
Ahh, that may be it. I never did much perl because, well, I'm not a sadist.
 
meh
perl is good imho
it's like C++... you can do horrible things with it
 
9:45 AM
It may well be good, but I've never seen a piece of perl code written by someone else that was ever approaching readable.
Kind of a turn-off
 
you've never looked :P
 
oh god 2.99 out of 5 because it says I did 2 things wrongly. probably misread something.
 
RT is some of the better perl code I've worked with
 
@FlorianMargaine obligatory
"Perl - The only language that looks the same before and after RSA encryption" - Keith Bostic
5
 
however didn't finish Q2 because I had to do something for my boss -.- dang it
 
9:46 AM
I would, but Python is next on my list of things to get good at
 
@DaveRandom That'll take you all of... ooh... an hour. :P
 
dave, i dont know if ! works with in_array
echo in_array($value, $array);
when i do that
 
foreach ($value in_array($array)) { ... }
 
i get a 1
!in_array($UserID, $oneTimeUsersArray);
for that echo, i get no output?
 
@johnc. false becomes "" when echoed
 
oh really
what is the point of that? lol
 
@johnc. that's dynamic typing
 
i see
 
Not sure what was the reasoning behind empty string, though.
I personally would have accepted "0" as well ... I think
 
@Ja͢ck false == "0" == "" == 0
 
9:53 AM
Isn't it fun
 
yeah thats what i htought lol
 
null == false
 
in addition to being rebecca black honours day, it is also en.wikipedia.org/wiki/International_Day_of_Happiness
 
> DO NOT HARM A PERSON OF GOOD WILL
 
how do you echo an array value? echo $array[0]; doesnt work
 
10:00 AM
That's because echo $array[0]; is probably retired.
 
?
 
That's a plausible reason why it wouldn't work.
 
@FlorianMargaine That... actually reads like real code. This is genuinely a first for me.
 
Is that Perl 6 syntax? Never seen those => before
 
10:04 AM
So... it seems like variance should be inverted for each nesting level. This is gonna be fun to explain in RFC
 
is it just me or is stackoverflow just slow right now?
 
just you
 
@PaulCrovella /me immediately changes the password for the network administrator account on my corporate network :-S
 
stackoverflow is just slow
 
@DaveRandom to 0hfuck1ngHe11
 
10:11 AM
is strpos even working 100% at all time for E.G a starts with?
 
@DaveRandom note that there are some sigils like @_, but the code is mostly fine
And the sigils... Well you need to learn them
 
@Ja͢ck heh, perl 6 is such a PHP rip-off :D
 
:)
@MikeM. I would use strncmp() for "starts with"
Or strrpos()
 
@Gordon ?
 
@FlorianMargaine because it uses => and $ ;) </irony>
 
10:24 AM
@Gordon oooh
 
The eclipse should have happened yet I looked out of the window and didn't notice anything. Not even that it's darker ...
 
it did here, kindof. Less "darkness" than the last time
I don't get the hype that was around here beforehand
 
me neither xD
however I noticed nothing yet it did happened
 
we live in the wrong part of the world apparently
 
youtu.be/7Egm1Z5OYcU?t=1h3m12s <= it looks like hell is coming to earth.
 
10:42 AM
@MikeM. where I live there is sooo many fog, you didn't see anything of it..
 
@Naruto Kinda same here but it didn't even become darker...
 
middle of the night here. also not darker.
 
!eclispe Not really unexpected as we both live in the brighter zones @MikeM .
 
neither did it become dark here, it was only a 84% here, and you need like 94% to even notice it getting darker?
 
@Rangad You live in the netherlands or just some weird other country that had the same issue with this ? XD
 
10:46 AM
hey guys
 
@Japa Hola.
 
currently on my back from Sweden to Germany.
 
This is me when I finally understood variance i.imgur.com/nO8rZ.gif
 
@MikeM. ola mike m.
@MikeM. spain?
 
Nope :-)
@Rangad So same weird countries xD
 
10:47 AM
could someone correct my syntax here?: it´s not working, i think i can´t do this: SELECT a.username, a.nome,a.password,a.ativo, b.Nome as nomeHotel
FROM Utilizador a left outer join Hotel b on a.Hotel_idHotel=b.idHotel WHERE ativo='0'
 
@Tyrael reddit.com/r/PHP/comments/2zl40g/… wasn't Joe involved in phpng too?
 
i want to say where the ativo is equal to 0, how could i do this?
 
ativo='0' shouldn't it be a.ativo then?
 
hummm gonna try it
1m
no, doesn´t work...it still returns me all records that have ativo=1
and it shouldn´t
it should return nothing
 
maybe = 0?
 
10:49 AM
:(
 
without quotes
 
hardly to believe but trying isn't bad :-)
 
indeed :D
 
no guys...i try this, and it doesn´t work: SELECT a.username, a.nome,a.password,a.ativo, b.Nome as nomeHotel
FROM Utilizador a left outer join Hotel b on a.Hotel_idHotel=b.idHotel WHERE a.ativo=0
it gives me records with ativo = 1
what am i missing here?
 
what the heck am I looking at?
(php-src, not sure if anyone knows that error)
 
10:52 AM
@Ocramius the shell at Marcos Macbook Pro
 
@Japa can you create the table(s) with 2 inserts and the checks here: sqlfiddle.com
 
@Gordon =_=
 
@Ocramius correct answer is correct
 
@Gordon redundancy is redundant
 
@Ocramius ./buildconf
 
10:53 AM
^
 
@MikeM. what for?
 
so we can play with the query and help you properly further.
 
@FlorianMargaine thanks. Was using autoconf :)
 
@MikeM. let me try
 
@Ocramius np. Classic thing is ./buildconf && ./config.nice && make
if you have a config.nice, of course
 
10:55 AM
meh, now complaining about bison -.-
 
^^
too recent?
 
probably
 
you can fix the configure for that
 
2.3 here
 
oh
too old
2.7 min
and 3.0 is skipped... but you can still use it by fixing the configure
but for 2.3, yeah, upgrade
brew install bison probably fixes it
 
10:57 AM
yeah, had 2.7, but in the wrong $PATH
 
ah
good thing :P
 
oh! man this is so strange, i have been trying in mamp pro the commands i show you here and it didn´t work...but right now i have tryied in workbench and this worked: SELECT a.username, a.nome,a.password,a.ativo, b.Nome as nomeHotel
FROM Utilizador a left outer join Hotel b on a.Hotel_idHotel=b.idHotel WHERE a.ativo='0'
 
anyway, it's crunching now
thanks a bunch :)
 
then its not with the query anymore except you had to do it with a. for sure
 
11:04 AM
@MikeM. you´re right
the a was missing
thank you for pointing me that
:)
 
No problem, Keine problem, Geen probleem!!!!
 
@MikeM. but this is a very odd behavior, if i use mamp with the same commands...it doesn´t work...and in my application it doesn´t too
 
No idea.
Never worked with mamp...
 
@Japa step 1: don't use mamp, step 2: put the code in a pastebin where it doesn't work and post a link here
 
ok...
 
11:11 AM
sigh
 
You got self driving cars
We got COOLWHEELS (^_^)
 
@MikeM. ok the part that is not working in my .php file is in here: pastebin.com/J9f1DTGw but if i do it directly in mysql it works
wait
let me do it again
ok this is the correct one: pastebin.com/2Z3DeeWd
 
@Japa why are you not programming in english? :x (and no, my native language is not english either)
 
@Patrick i know, i wil change that but that´s not the problem
you´re right
 
11:23 AM
It also makes helping you harder
 
@Japa It is a problem now
Because of what @Patrick said
 
ok guys, i´m gonna change that ... i´l be back
1m
pastbin is asking me to wait
man! alternative to pastbin?
 
@Japa also, wtf is that ->{'foo'} thing for? You don't need that, see 3v4l.org/iaXYU
 
i will change that too, meanwhile: paste.jesse-obrien.ca/1QZC
 
@Japa what is the output of var_dump($idUsers) ?
 
11:30 AM
:O it´s NULL
 
and what is idUsers? foreign key user_id?
@Japa well, glad to help. next time try some debugging yourself first ;)
 
it´s the id of the row
 
@Japa why not just call it id then?
 
which it seems to be null
yes...why not
 
mon-ring
 
11:36 AM
@MarcelBurkhard about your question yesterday, I would put it in the dependencies file. Or if you are feeling very fancy, put it into a factory :D
 
@Patrick well I'm working on that at home, had to go to bed though, will try it out on sunday probably ^^
@Patrick I'll actually write down how it's done when I managed to do it in a clean way... https://github.com/burki94/no-framework-tutorial/blob/master/12-doctrine.md
I'll submit I PR then.. (I'm not sure if it fits the scope of the tutorial, no hard feelings if you deny the PR ^^)
 
@MarcelBurkhard I am not sure yet. Even if I do, I want to introduce PDO first. Maybe mark it as a bonus chapter? Then I can include it even if it's not part of the main tutorial
I'm also not sure how much time I'll be able to spend on the tutorial, got started on that book... :)
 
yeah sounds great, could make a bonus chapter about phpunit aswell
I'll figure out a way to structure it in my fork and request your feedback then
and good luck with the book :)
 
awesome, thanks
 
Huuuray to Friday releases!!!
 
11:47 AM
@Patrick If you don't mind me asking, you work 100% Pensum (couldn't find a fitting translation ;D ) ?
 
@MarcelBurkhard 80%
today is my day off
 
ah nice
I'm considering reducing my Pensum temporarily to be able to spend more time at home to learn stuff, cuz apparently I suck
 
@Patrick thanks for your help
 
@MarcelBurkhard yeah the day off is great for that (or doing nothing every so often). But it sucks that you are kinda expected to learn in your free time in IT...
 
well I'm happy still, the money is great ^^
I think of it more like this: I invest time at home so I don't have to go to an university to get a decent job
and I like doing it anyway..
 
11:55 AM
+1 :)
 
Email exchange between 2 colleagues I just found while looking through the mailbox archives for something:
Guy 1: I had 20gb of interracial porn on here what happened to it !?
Guy 2: I re-rendered the colour balance so it's now all blue-on-orange. I figured you were into Smurfs and Oompa-Lumpas so it made sense.
 
@nikita2206 Absolutely agree.
 
@DaveRandom, wow :-)
 
12:11 PM
@daveR
:D
I just joined to wish you a joyful weekend.
(because tomorrow is an official workday where I live)
I'm really jelous of you all....
 
Is github.com/lisachenko known by a different name? And/or do they hang around here?
 
@Danack no, he's usually only on twitter, but I'd invite him here
he's an amazing person building way too much magic :)
 
@Ocramius ok, he just said something.......not as clever....but if he's a nice guy I'll try to be nice (for a change).
 
@Danack @Alexander ;-)
 
@Danack eh, happens
oh, interesting, so he is around :P
 
12:16 PM
@bwoebi I actually came to conclusion that with each nesting level, variance should be inverted. I tested it in Scala, seems like it holds to this rule as well
 
People should not be allowed to use different names in different places.....it confuses me.
 
keybase.io ftw then
 
Said Dan Ackroyd
:P
 
I have almost perfect anonymity when using my real name...
 
hate AOP in php..
 
12:23 PM
@nikita2206 What do you mean with variance inversion?
 
12:35 PM
^ not E_FRIDAY
 
vi is better than emacs
 
Java is better than php
 
a project manager asked me to explain what "file system" is
 
12:43 PM
Could someone please help me with an SQL query: stackoverflow.com/questions/29166668/…
 
add indexes
 
Thanks, but the thing that makes it difficult is where to put them
I provided an SQL Fiddle in the question with a DDL to show where they currently are
 
you should be indexing columns which you are using in WHERE and JOIN statements
also, you should probably learn SQL before using it
 
what makes you think I haven't indexed columns in the WHERE and JOIN statements?
If you have a look at the Fiddle you will see I have already done that, I politely asked for your help, not to insult my intelligence
 
@AlmaDo Close this tab and go to the java room PLZ!
 
12:56 PM
python is better than php
 
ruby on rails is better than php
 
@FlorianMargaine I wasn't completely sure, so I checked the original introduction mail from Dmitry when he pushed the phpng branch, and it was only mentioning Laruence and Nikita
 
@Tyrael fair enough, that may be just me
 
but I have some vague memory of krakjoe getting hyped up to jump into the patches
 
1:02 PM
yeah dunno why, I thought @JoeWatkins had done a lot of work on phpng...
 
@AlmaDo it may be more useful to start flipping these around if you want to stir things up
 
based on git it seems that he wasn't involved (or he did not commit those changes himself)
git shortlog -s -n PHP-5.6..master|head
git log PHP-5.6..master --author=krakjoe --name-status Zend
 
good. two men trolled
 
@Alexander That code gets called for every class loaded. It's okay to have some complexity in it. Trying to make it look nice by splitting it into different functions would make literally every server that uses the Composer autoloader be slower.
 
1:12 PM
0
Q: How to add pagination into post showing

Prabhash Rawati have make a plugin and i want show all post on any page by short code using but when post showing i want to show post with pagination, but i have no idea how can i do this can any one help me for this. my working is global $wpdb; query_posts('cat='.$cat); $table_name = $wpdb->prefix . "adv...

 
"asked 15 mins ago"
 
amg, I just noticed fb tracks you when you are on stackoverflow :O
 
Back in our days there was no SO ..
 
@Tyrael seems I was severely wrong :-)
 
and we somehow managed to resolve our issues (:
 
1:15 PM
@AlmaDo yeah, it just took you 10 hours instead of 1
 
@FlorianMargaine no, it just made you think
 
@AlmaDo I wouldn't call that trolling (^_^)
 
1:53 PM
Good morning
 

« first day (1616 days earlier)      last day (3347 days later) »