logs archiveIRC Archive / Freenode / #php / 2015 / July / 8 / 1
Arrick
runinsquares, actually if you were to write a quick function for me, I would be able to use it for reference and it would let me do the rest of the form as well./
cwhitesc
Arrick: You mean like this: https://gist.github.com/chrisatsc/75624ac498b97a7274ee
Its just math
Dustin|Work
Alphos, Yeah thats next on the list, this is just made for me to test sh*t on my server, this function is only accessible by me at the time
Arrick
cwhitesc, its missing 1 part... for every 1 digit above 6, it should add on 5147
Alphos
Dustin|Work !+later
php-bot
Dustin|Work, best practices  like input validation, prepared statements, testing, coding style, and so forth  are important. Many people say they "just want to get it to work" and claim they will "fix it later." Though they might even be sincere, it **never** happens. Don't be that person! Do it right the first time!
cwhitesc
Nope, thats in there
Arrick
I misread it, thanks
I thought I was close, but not quit on it
cwhitesc
The parentheses arent quite right
         

Arrick
yeah, it was missing a trailing
Dustin|Work
Well technically I have already switched over to a upload library
cwhitesc
Yes
Dustin|Work
But haven't commited that change to this branch yet
But Im well aware of !+later
:P
Arrick
thank you guys so much
next one guys, I need to take appDOB and subtract todays date, and get the current age (number of years) of an app
both are date fields in the format of m-d-Y
I cant just subtract the years, because it will skew it
Alphos
Arrick that's what DateTime::diff() is for
Arrick
ok
Alphos
you'll need Date::createFromFormat() too http://php.net/datetime
make that DateTime::createFromFormat
theskillwithin2
zsh keeps saying i haz mail!
but i use gmail
jani__
hello. I have this code http://hastebin.com/sazonapigu.m and it gives me Division by zero warning. how can I remove this ?
Alphos
by not dividing by 0
laszlof
^
Alphos
captain obvious, to the rescue !
laszlof
what are you even trying to do
jani__
yes
laszlof
heh.
that was a question
kgee
adding count() around a modulous doesn't make much sense in.... any context.
jani__
mean ?
laszlof
what are you trying to do?
what is your end goal
Alphos
kgee true :D
         

jani__
i just treid count. if remove then still same issue
Alphos
jani__ again, what are you trying to do exactly ?
(other than dividing stuff by 0, i mean)
laszlof
they do that in ohio i heard
(Action) trolls the buckeye fans
jani__
my record is coming. and I want to assign 'mright' css class to the odd record
laszlof
if ($foo % 2 != 0) { // its odd
Alphos
"record is coming" made me think of game of thrones. THANKS A LOT !!!
kgee
jani__, verify both $total and $key are numbers. preferably whole ones. Add spacing around your '%' operator. that sh*t is ugly. While your at it, tell us what you want
Alphos
kgee i'm guessing $key is 0 actually ;)
Happy_the_Exceed
kgee
Alphos, yeah I can imagine php treats (x % 0) poorly
Alphos
Happy_the_Exceed WHAT ? XD
kgee it treats it like a division by 0 ;)
which is why he got that error message :)
laszlof
jani__: <?php if ($key % 2 != 0) echo 'mright'; ?>
jani__
obeiosly first record key will be 0
laszlof
though im not sure what it will do with 0
Alphos
jani__ do you even understand what a modulus is ?
laszlof
i guess it should treat it as even.
kgee
jani__, there is your problem. dont mod by zero
Happy_the_Exceed
Depending on language, modulus is treated differently.
Alphos
laszlof 0%2 === 0
Happy_the_Exceed modulus != module ;)
laszlof
ah, right
Happy_the_Exceed
Well, the % sign then!
Alphos
but well, php's modulus isn't a module, so...
php's % is a modulus iirc :p
you english speakers are so effed. we have one word for the two !
kgee
jani__, http://stackoverflow.com/questions/18069825/division-by-zero-error-while-using-modulus
jani__
laszlof: got your point.
thanks guys.
Alphos
jani__ which point did you get ? laszlof made several
laszlof
by point, I think they meant the code I posted that worked
lol
cwhitesc
Seems like something that should be done solely using CSS anyway
Happy_the_Exceed
Alphos, tbf, all forms of English is dumb -__-
Or, inconsistent at least.
Alphos
Happy_the_Exceed : don't you mean "are" ? :p
laszlof
cwhitesc: probably
Happy_the_Exceed
It's like the PHP of languages.
Alphos, yes, ARE since I said forms
-_-
Alphos
:D
laszlof
nth-child ftw
Alphos
Happy_the_Exceed : to be fair, all forms of english @is dumb ! :p
pihpah
Stupid question, but why actually this code evalutes to true: php -r "var_dump('A\\B' === 'A\B');" Do PHP not escape characters if they are not special?
ks
what's more compute efficient than following $d=date('Y-m-d', strtotime('+'.$i.' day')); < I run this in a loop and think if there's better way to do it
pihpah
Stupid question, but why actually this code evalutes to true: php -r "var_dump('A\\B' === 'A\B');" Do PHP not escape characters if they are not special?
Happy_the_Exceed
(Action) always wanted to learn Japanese. To read/watch their anime/manga without having to pause for everything/missing out on subtle differences.
pihpah, something like that.
Alphos
pihpah what you have two three-char strings there, composed of an uppercase A, a backslash, and an uppercase B. they're both composed of the exact same chars. not sure what you'd expect when typing twice the same thing
oh, didn't see you had a single \ in the second one. still the same answer, except without the last sentence ;)
Happy_the_Exceed
I'm a bit annoyed by it.
Alphos
i'm not, it's fun to have to remember if you're in single or double quoted strings. keeps you aware
Happy_the_Exceed
But they both are single quoted.
Alphos
"\n" (one char) is not the same as '\n' (two chars) : fun !
jeffreylevesque
#scikit-learn
Alphos
Happy_the_Exceed that's a quirk at best ^^
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 next »