logs archiveIRC Archive / Freenode / #php / 2015 / September / 7 / 1
zLouD
crazy_rudy_: read it in english please: Start here: http://php.net/manual/en/langref.php
crazy_rudy_
variable is defiend like : $k1; $ta;
__adrian
what?
crazy_rudy_
what the hell meaning of this !?
and this is not documented !
Robdgreat
that's not how you initialize a variable
__adrian
you mean you have code that looks like this? http://viper-7.com/LCoKrX
crazy_rudy_
no
Robdgreat
I think the only solution here is to track down your predecessor and use physical violence
thrashy
yup, i jumped into php earlier this year after being in a windows/C# environment for 10 years... it's much easier when you learn the basics, rather than bursting into irc channels and asking specific questions or going to stackoverflow
         

__adrian
i don't think your "previous programmer" knew php either
crazy_rudy_
no meaning of variable name.
and no documented
and ..
Robdgreat
I maintain that my solution is the best
crazy_rudy_
finally, i can understand why other programmer talks that dynamic language is hell.
__adrian
interesting that $var; doesn't trigger any errors, but $var is still not set
crazy_rudy_
i didn't feel in python.
__adrian
dynamic languages are only hell if you don't learn them before you start coding
thrashy
lack of experience in any language leads to frustration
__adrian
and in fairness, this is true of anything
crazy_rudy_
because php allows appending index to undefined array, this is hard to understand where it started.
__adrian
so, don't do that
crazy_rudy_
yes, `$list = array(); $list['foo'] = 'foo';` is better than `$list['foo'] = 'foo';` right?
__adrian
"what a language allows" is not a measure of how poorly you have to write it
crazy_rudy_
__adrian: but it makes more bad codes.
__adrian
no, it does not.
it might not sufficiently frustrate and chase away bad coders.
but it does not _cause_ bad coders.
crazy_rudy_
__adrian: absolutely, it makes many beginners to make bad code easily.
__adrian
which is why php is so popular.
but you don't have to suck at it.
the array question: it depends, but yes, $array = []; $array["foo"] = "foo"; is more obvious.
crazy_rudy_
__adrian: yes, and more obvious code is important to maintain the code. right?
__adrian
sure. but $array["foo"] is not always non-obvious.
crazy_rudy_
__adrian: when ??
         

__adrian
e.g., function something(){ $a["foo"] = true; if( false ){ $a["bar"] = false; } return $a; }
making your code in small, digestible bits goes a long way for understandability+maintainability
Genome36
hello
how do you call this type of operation ?
__adrian
what operation?
Genome36
$var = ($value == True) ? "A" : "B"
__adrian
Genome36
ty
__adrian
welcome
Alphos
you don't even need ==true
Genome36
ummm
actually i was aiming for ? :
Alphos
you NEVER need ==true
Genome36
the ? "A":"B"
Alphos
Genome36 yes, that's a ternary
Genome36
oh ok
__adrian
$var = $value? "A" : "B"
(assuming $value is defined, of course)
Alphos
but ==true is pretty much useless. if ==true works for you, so will the thing you were comparing to true all by itself
Genome36
Alphos: i know how to code
__adrian
well, ==true is eactly what ? does anyway. "truthy?"
Genome36
and i know that i can just use a varial without comparison as the value or method can return or be equal to TRUE
Alphos
Genome36 even if it's not equal to true
Genome36
variable
yup ik
Alphos
even if it's "a" or 1 or array(3)
Genome36
true or false
0 or 1
and other numbers
Alphos
!+===
php-bot
[===] Loose/strict comparison chart http://php.net/manual/en/types.comparisons.php ; == compares value, === compares value, type and prevents numeric interpretations of strings
__adrian
Genome36 he's mentioning it because the example you posted uses a construct which is never nescessary
which implies "maybe they didn't know ..."
if you did, then fine
Bad_Advice_Cat
Genome36, we are trying to point out to you that YOUR method is loose comparison.
Genome36
yup
i know
was just an example >.>
my bad if it was a mistake
__adrian
yes, but it's an example that looks like a mistake/misunderstanding.
Genome36
sorry
__adrian
np, just trying to help. it wasn't a shot at you
Genome36
i usually do $var = $value ? "A" : "B"
for a matter of fact i use it but never knew the operation name XD
anyway, ty Bad_Advice_Cat, __adrian & Alphos
Alphos
yw
Genome36
later o/
marlun
I've added bootstrap="vendor/autoload.php" in my phpunit.xml but phpunit still doesn't find a class which is working just fine when I require the autoload file and then instantiate in another php file. Not sure how to make sure phpunit is actually loading the autoload file?
Tried to just add the require line in the test file but that didn't help either...
oh well, now it stopped working everywhere, guess I messed up somewhere.
zLouD
I've got a question about php-fpm
What is the necessary entry in the apache vhost file to have a working php-fpm binary with mysql etc. etc.
https://www.howtoforge.com/using-php5-fpm-with-apache2-on-ubuntu-12.04-lts
I used this so far, is there more required ?
django_
Anyone worked with amazon API?
sorabji
zLouD: never used fpm with apache, but that looks reasonable enough i guess
django_: i'm certain some people have
Azrael_-
zLouD: if you can run php, then you can also use mysql, nothing more needed afaik
je-m`en-foutiste
shouldn't just applying the prepared statements technique on the user input enough to work with it securely when accessing the DB ?
sorabji
what?
Azrael_-
je-m`en-foutiste: please provide an example how you use it
je-m`en-foutiste
Azrael_-: like when a user enters data in a text input box in a webpage's form, and dynamically with his keypresses, my ajax script seeks the mysql DB an returns matching results, i was wondering the prepared statements is enough to santanize the user input and use it to get data from the DB
*wondering if the *
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 next »