« first day (1561 days earlier)      last day (3384 days later) » 

1:58 AM
I often hate PHP, but...
<?php
$x = [];
if (!isset($x['foo']['bar'])) {
    $x['foo']['bar'] = 3; // this works, <3 u PHP
}
 
OIS
well, it isn't set :)
I wonder how that code would look in Java
 
2:41 AM
I actually dislike null->array promotion, but... meh
 
c9s
2:52 AM
$x['blah'][] = 3
 
$blah[][] = 3
@c9s hey, you're here too :D
 
c9s
hi @marcio!
yeah :-p I came here from a link in ... some of my tabs ... (already forgot)
 
what link?
 
c9s
already forgot XD
 
hope to see you on internals list too
 
c9s
2:58 AM
i am actually listening to the internals list :p
 
well, then stop listening and go write some RFCs
;)
 
c9s
haha I will give it a try
 
user895378
3:08 AM
/me lurks
 
Hey guys,
What is HHVM?
 
c9s
@marcio I really love the new phpbrew extension installer (thanks to @racklin++), it's really easy to get something installed via a quick command: phpbrew ext install github:sgolemon/objectifier
 
3:40 AM
that thing made me so lazy, phpbrew ext install github:nikic/php-ast is a cool ext BTW by @NikiC
 
4:02 AM
@HassanAlthaf HHVM is an alternative PHP runtime that is insanely fast and crashed a lot last time I used xD but it's getting better, so try it yourself.
 
4:14 AM
^^
I think return types are going to pass.
 
user895378
At 47-3 I think that's a pretty safe bet :)
 
Composer isn't just like npm. It's better than it.
 
user895378
I definitely appreciate composer more than I used to.
 
I like how it assumes SemVer and it generates requirements for you
That's wonderful compared to the anarchy that is npm versioning
 
c9s
is there any one knows the status of scalar type hinting RFC? I saw it has been proposed for more than 2 years (the "with casting" one)
I'd like to dive into the issue and see if I can do something :p
but I think we should go with the simple one first.
 
4:34 AM
@c9s Yes, actually @AndreaFaulds works on scalar types all the time ^^
 
@LeviMorrison For whatever ridiculous reason.
 
^^
Well Return Types passed.
11
 
user895378
\o/
 
@LeviMorrison ElePHPants rejoice!
@LeviMorrison Post about it on twitter with #sexy #hashtags and get all the retweets.
 
user895378
@AndreaFaulds yes, do this @LeviMorrison
 
user895378
4:44 AM
And then onebox the message here.
 
I will.
Still composing emails and such.
 
Is master/slave the only solution If I want to make replication between mysql on localhost, and MySQL on free webhosting like 000webhost? Are there easier solutions?
 
mornin
 
c9s
@AndreaFaulds for what reason? :p
 
gonna sleep
night
 
4:52 AM
morning
 
user895378
@AndreaFaulds night
 
c9s
@AndreaFaulds good night :)
 
@LeviMorrison \o/ congrats
 
The Return Types RFC for #php has been accepted with a vote of 47 to 3: https://wiki.php.net/rfc/return_types \o/
 
user895378
@LeviMorrison First RT award!
 
c9s
5:06 AM
@LeviMorrison++ I love that
 
the type hinting rfc is a pesky task
 
c9s
@LeviMorrison however I think the reference symbol should be on the left of the return type :p
 
Eh, it was discussed at some point.
 
c9s
something like this: function createUsers() &array { } hehe
 
General consensus was that it wasn't worth going down that route
 
5:14 AM
damn... php-src master faints and segfaults all the time with real world code :/
& === segfault
 
c9s
@LeviMorrison understood. so the reference syntax was actually introduced in the older version, changing it might break the compatibility
 
@LeviMorrison a good collateral is that PHP return types is compatible with hacklang
 
> I have close the voting.
^ lol I'm too tired.
I proofread it a few times, still didn't notice.
 
5:32 AM
hi
I am new in php this is i known confection
class{}
inside of class {}
 
c9s
6:27 AM
didn't find the doc about the return type hint for reference. but I actually prefer the type hint from HHVM, it's more powerful than Zend PHP
 
6:52 AM
well done @LeviMorrison
 
user3949359
7:12 AM
What does "relational" stand for in "relational database". What does it exactly have to do with tables?
 
pls somebody helps me out of this hell...
i had tried may solutions. None have worked..
 
A relational database is a digital database whose organization is based on the relational model of data, as proposed by E.F. Codd in 1970. This model organizes data into one or more tables (or "relations") of rows and columns, with a unique key for each row. Generally, each entity type described in a database has its own table, the rows representing instances of that entity and the columns representing the attribute values describing each instance. Because each row in a table has its own unique key, rows in other tables that are related to it can be linked to it by storing the original row's unique...
 
Hi i want to create user friendly URL to my website like google blogspot, wordpress and other cms's use like.
 
@AvinashRaj you need to set the socket in your configuration (php.ini) to the correct location, probably /var/lib/mysql/mysql.sock
if phpma config overrides it, set it correctly in config.php for phpma too, I can't remember, it's been many years since I set that up ...
 
7:30 AM
which php.ini file?
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini
/home/avinash/Desktop/php.ini~
/opt/lampp/etc/php.ini
/opt/lampp/etc/php.ini-pre1.7.2
/usr/share/php5/php.ini-development
/usr/share/php5/php.ini-production
/usr/share/php5/php.ini-production.cli
 
@AvinashRaj whichever one php is using. check phpinfo() - it'll be under "Loaded Configuration File"
 
you mean , i have to set the above in
; MySQL defaults.
; php.net/pdo_mysql.default-socket
pdo_mysql.default_socket=
^^^
this place? After the = sign.
; http://php.net/mysql.default-socket
mysql.default_socket=
i would like to ask this as a question.
Which site did i have to choose?
Askubuntu or SO ?
 
 
2 hours later…
user3949359
9:21 AM
Why are spinning hard disks still in use? Why isn't everyone on SSDs?
 
@nosille If you want to give me 4TB in SSDs I'll be happy to retire a couple spinning disks.
 
Morning
 
user3949359
@PaulCrovella How big can they get usually?
 
monrin' @PeeHaa
 
@nosille Because imho ssds are overkill for my data
Nice @LeviMorrison!
 
9:30 AM
@nosille go to newegg and take a look at the relative prices per GB.. you'll get an idea why spinning disks are still in use
 
user3949359
@PaulCrovella Thanks
 
I watched the entire thing.
 
It's been looping here for 20 minutes now
 
10:02 AM
Mornings
 
Morning @RonniSkansing \o/
 
o/
It is snowing like crazy outside =[
 
in Android, 9 mins ago, by PeeHaa
yeah same here :( ugggh
in Android, 9 mins ago, by PeeHaa
Although it looks more like ice
 
user2620028
I am fairly new to php, I am attempting to build a project website and i do not have every file in the same directory. I have the file structure built for being able to find my resources easily. That being said how do i dynamically adjust my file paths depending on where i need to be calling the resource from?
 
@HatterisMad Use __DIR__ . '/relative/to/the dir/of/the/file.php'
 
user2620028
10:07 AM
that is two underscores DIR two underscores?
 
yes
 
user2620028
and when you say relative to the directory of the file
 
user2620028
which file do you mean?
 
The file you call it from
Alternatively you could define a constant yourself to the project root, but I don't like that in general
 
hi
 
user2620028
10:09 AM
I knew these existed i just haven't found a competent explanation as to how they work and how they are to be used. Back to the google fu to see if i can find a better explanation
 
what is different in php and cakephp
 
O_o
One is a piece of shit and the other is also a piece of shit but not a framework?
 
but not make it the php framework
 
Route log not defined when trying to redirect a route in controller
//routes.php
Route::get('/','Logging@index');
Route::Resource('log','Logging');
//Controller
$route=Request::path();
if(Auth::check())
return View::make('test');
else if($route=="/")
return Redirect::route('log');
else
return View::make('login.sign_in_form');
 
I am having a hard time to look at laravel code when I haven't eaten yet
 
10:21 AM
@PeeHaa :D
 
user2620028
why is php so stupid
 
@HatterisMad so as the programmer.... :)
 
@user2736704 please stop using static classes
 
@tereško wY?
 
because it causes tight coupling and relies on global state
 
10:26 AM
@tereško As am bignner to php so I will try my best but thanks for the suggestion
 
user2620028
No i am just curious as to why it can't handle its own file paths
 
user2620028
I actually know the answer to why it can not but it is just frustrating to me haha.
 
@HatterisMad I probably have missed some past discussion, but what are you trying to solve ?
there probably is a better way to approach it
 
user2620028
There absolutely is a better way i know but i don't entirely understand the examples i keep finding on the net
 
net is filled with crap
 
user2620028
10:30 AM
i am trying to include files in each other in a filestructure and i am using relative paths
 
user2620028
so when i include my user class and it tries to include the db config file i am getting a file not found error
 
user2620028
because it is trying to use the path relative to the file that included the user class file
 
yeah , that's sound like architectural issue , actually
you should let the autoloader to include the class files
 
user2620028
auto loader?
 
one moment ..
 
user2620028
10:32 AM
I don't have a PHP IDE. Notepad++ lol
 
no, no, no
it's unrelated to IDEs
I am trying to find a good page which explains autoloading in php
 
@HatterisMad Given how it uses __autoload it's not a good page.
also, mornings :)
 
morning, since only rebeka shared here youtu.be/pbUb3ilK9Mg?t=1h11m54s
 
morning @NikiC, @tereško
 
user2620028
10:34 AM
Morning guys
 
basically
at the top of your index.php file you put
 
@animaacija That is pretty fucking awesome
 
$path = '/path/to/all/my/classes';
spl_autoload_register( function( $name ) use ( $path ) {
    $filename = $path . '/' . $name . '.php';
    if ( file_exists( $filename ) === true ) {
        require $filename;
    }
});
@HatterisMad this will register the function to be executed every time PHP tried to instantiate an unknown class
 
user2620028
An unknown meaning a class outside of the default php library?
 
"unknonw" as in "not included yet"
 
user2620028
10:39 AM
and all of your classes have to be in the same directory for this to work?
 
well ... it's getting complicated
php has namespaces
 
user2620028
I have not quite understood how php handles namespace yet :/
 
you can use these namespace to help you with mapping the subdirectories
also you can have several autoloaders registed
and each autoloader can try to look for files in several locations
 
user2620028
how is this beneficial over what i was doing?
 
"all classes in same directory" is just the most simple case I could think of
@HatterisMad you do not need to worry about "what is the relative path here" crap
 
10:43 AM
...maybe he should get a sense of how to include a file before jumping into autoloading, namespaces, and such.
 
user2620028
I do not understand how this solves that problem.
 
user2620028
I know what namespaces are (although php i have not grasped entirely yet i will admit) and i understand how the includes and requires work.
 
@HatterisMad Autoloading just includes the correct files for you instead of having to manually use include / require
 
so, what you are saying to me is "I don't understand this and I don't see how it helps me, so you have to prove to me that it will" .. ya know , fuck it. It's saturday and I have more valuable things to do
 
user2620028
But the code that you added there just checks to make sure the file exists and then it requires it. If that code is also run from the context i was running it before then my include inside of my class would still be referencing the relative path of the file that instantiated the class
 
user2620028
10:46 AM
You can fuck it all you want bud. I appreciate what help you gave.
 
CATurday
 
user2620028
in the park
 
@HatterisMad It is customary to write __DIR__ relative autoloaders
 
user2620028
@NikiC that makes a lot more sense to me.
 
spl_autoload_register(function($name) {
    $filename = __DIR__ . '/' . $name . '.php';
    if (file_exists( $filename)) {
        require $filename;
    }
});
here __DIR__ is the directory of the file you wrote it in. So if it's in ./web and your classes are in ./src you write __DIR__ . '/../src/' . $name . '.php'
 
10:52 AM
@NikiC he did not see __DIR__ in that sentence
... or maybe, did not understand it
 
As far as I am concerned any path that is not __DIR__ relative or absolute is a broken path.
 
user2620028
@tereško I did see it and i did understand it.
 
ThW
Morning
 
Morning @ThW
 
@ThW Morning
 
ThW
11:02 AM
talk done, slides uploaded, ... I need more coffee :-)
 
What talk? Which slides? :)
 
ThW
Just uploaded the slides for my talk at #phpbnl15 https://speakerdeck.com/thomasweinert/pcre-with-php #pcre #php
2
 
@ThW when is the video going up?
 
ThW
@PaulCrovella Never, here was no camera
 
:-)
 
11:09 AM
aww... :(
 
my talk is in 1:30
 
ThW
@ircmaxell "High Performance PHP"
 
yup
talking about compilers, yet again :-D
 
morning @ircmaxell
 
Guys, is 200-300 rows reasonable to fetch in one query?
 
11:14 AM
@user3692125 yes
 
@NikiC how's it going?
also: it's afternoon
 
going fine :)
@ircmaxell but but UGT
 
@ThW One thing I'd like to see on that unicode slide is a bit about \pM - people miss it all the time when they're trying to match graphemes
 
:-D
 
where are you @ircmaxell?
 
11:16 AM
@NikiC had some nice basic talks with @SaraGolemon here trying to figure out how to do some more complex optimizations in Zend...
@FlorianMargaine php Benelux conference, outside Antwerp
 
@PaulCrovella When matching graphemes wouldn't you be using \X?
 
Thinking about writing a C extension that intercepts the AST, converts it into a graph, does a bunch of small-to-moderate optimizations, then converts it back to the AST
 
@ircmaxell Damnit. I read that as if @NikiC were there :( Now we still have no proof of his existence
 
@NikiC I though \X was more like a . .. more specifically I'm talking about matching letters (with combining diacritics)
 
11:20 AM
so it can be cached, but doing things like global variable numbering, loop unrolling, dead-code removal, etc
 
@PeeHaa his or her.
 
would only likely get a few % in best cases, but could be interesting
 
@FlorianMargaine For now I will just say "the entity Nikic"
 
@ircmaxell dunno if the ast is really the best place to do that kind of stuff.
 
@NikiC it's not, but short of introducing a graph into Zend, what's the better alternative
 
11:21 AM
btw I think opcache has a basic block based cfg, so it probably already does dead code removal
 
well,
dead code removal in that unreachable code will be removed
but I'm talking about converting
function foo() {
    for ($i = 0; $i < 1000; $i++) {
        $a = $a + 1;
    }
    return 1;
}

// Into

function foo() {
    return 1;
}
 
@PaulCrovella Yeah \X is (at least in recent pcre versions) an extended grapheme cluster
 
the loop is dead, as it has no side effects and the output has no dependency on it
 
@ircmaxell ah, I see
so doing something like liveness analysis for vars?
 
@ircmaxell you're killing my speed-up loops?
 
11:25 AM
yeah, likely to only have a big effect in benchmarks, but useful none the less
especially with constant propagation
@PaulCrovella want to try
@NikiC precisely
 
I implemented an ast-based cfg for another language yesterday and it worked on first try. was seriously surprised there :D
 
woah, did you buy a lottery ticket?
also: are you cheating on us?
 
@PeeHaa I might give a talk at the ipc, which might resolve the question :P
 
@NikiC awesome! Glad to hear it!
 
@NikiC What's that? Google tells me it is International Pipeline Conference & Exposition 2014 :)
Ah international php...
 
11:33 AM
yeah, in Germany
I won't be there, but glad to hear you're getting out @NikiC
 
11:55 AM
@ircmaxell not just germany, but berlin ^^ don't have an excuse not to go there :D
 
heh, there will be Bergmann
 
In WAMP, how do I see outgoing emails? (I do NOT want to send them. I just want to store them. Xampp did it for me... )
 
ThW
12:44 PM
@PaulCrovella do you have a simple example for \pM?(that I could rip off)
 
user3949359
Can anyone refer me to a good AI book. I am searching right now and not happy.
 
@ThW Super simple example is (?:\pL\pM*)+ to match one or more letters along with any combining marks they may have. A mildly more involved example using them in lookarounds where \b will otherwise screw you is at stackoverflow.com/a/25865858/3942918 (ignore the <tag> stuff, it wasn't relevant to the question)
 
ThW
@PaulCrovella That looks good, thank you.
 
1:04 PM
@tereško please fix more than just the asp.net-mvc tag, for example by removing the tag from the title. — CodeCaster 41 mins ago
 
Morning
 
Morning @Leri
 
1:35 PM
@PeeHaa that's why we have
> Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User.
as close reason.
 
@AvinashRaj I don't know nor care about reading the super user faq to see what is and what is not on topic there. And blindly directing crap to another site is not nice
I would go as far as telling you stop directing crap to other sites
IIRC there even was some meta post about it, but I cannot find it
 
that question is perfectly suited for SU.
 
Well if you think / know so fine. Vote for it :)
 
 
1 hour later…
2:59 PM
Is there any reason why we cannot build an ext shared and the other statically if the dependency is optional? See also http://lxr.php.net/xref/PHP_TRUNK/acinclude.m4#1037
https://gist.github.com/bwoebi/aeb675ad37fea80f5658 would be a quick patch, to have the optional check around the whole function
Also, not sure if this should go into 5.5 or into master if it's okay.
 
3:21 PM
I've a function that takes a parameter of an array in the form of [string=>[string=>int]] - is there any way to mark that up as a @param type for phpdoc (aside from just using the description)? Right now I've got it as @param array[][] but the generated documentation results in the unsatisfying array<mixed,array[]>
 
don't use associative arrays...?
 
they're trigrams with weights (i.e. [two characters => [following character => frequency]), it's the most direct way to represent them
 
well, no, the most direct is in a Trie...
In computer science, a trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated...
 
@rdlowrey I'm doing a bunch of updates now. Should be available soon.
 
3:50 PM
Okay, I think it should be good to log into now, @rdlowrey.
As a reminder, you have access to /apps ^^
 
Hi!
 
@NikiC is there any specific reason why we don't evaluate operations between scalars at compile time?
 
@bwoebi we don't?
 
@NikiC not that I'd see it
oh
well
zend_ct_eval_binary_op()
sorry
 
How can I make something like this but working : pastie.org/9857049
 
4:02 PM
@VeeeneX You almost certainly don't want to do that. Just return it in one format, and then let the caller worry about converting it. But if you really do want to do it - stackoverflow.com/questions/1869091/convert-array-to-object-php
 
@Danack Thanks I wont use it as you said
 
user895378
@LeviMorrison thanks!
 
user895378
And: morning
 
4:18 PM
Can I stop code execution in function after require?
(fixed)
 
@c9s Obviously everyone is free to work on whatever they would like, but I (and a non zero number of other people) think that the strict version is the best version of scalar types. It's also probably the simplest, in terms of behaviour and explaining to users.
 
@Danack ext/strict :P
mentioning this, @AndreaFaulds isn't it time to put your RFC to voting?
 
No need to rush, mates.
 
@FlorianMargaine No.....there's really no clear consensus at all.
 
the discussion has stalled since a week or so
everybody has said what they needed to say I think...
 
4:31 PM
Just suggesting a load of options and seeing if any makes it through is not a good idea.
 
hello guys, I have deleted about 100 enteries from my database table
but now the new entry id is 100 offset
from the last entry
is there any way to reset the counter
 
@ShubhamNishad Why do you want to do that?
 
@ShubhamNishad mysql?
260
Q: How to reset AUTO_INCREMENT in MySQL?

Mor SelaHow can I reset the auto-increment of a field? I want it to start counting from 1 again.

 
@Danack, because my script mess up with the order of comments
if I don't keep the numbers organized
 
You are fixing the wrong problem here
 
4:38 PM
Florian, yeah, msql
 
what a bad script
 
@ShubhamNishad That is never a reason to worry about what the value of auto_increment.
 
lol, i know. it's made with CakePHP and I'm not inserting the id field. I don't know why cakephp give a random in between these "missing numbers"
random Id
@PeeH
I know, but there is nobody in mysql room
and people who know php usually know mysql too :)
 
?
I said you are fixing the wrong problem
You need to fix that horrible script of yours
 
it's not horrible script. It's pretty nice script :) but as I said 'id' field is 'autoincrement' and I don't really insert id field
so the fault is with mysql
 
4:43 PM
No that fault is with your horrible script
99% of the times you think you need to change the autoincrement value you are doing some horribly wrong
 
but it's fault of my own. I'm simply asking cakephp to retrieve data in descending order. either it's a bug in CakePHP or mysql that 'descending' doesn't work properly when id field is not consecutive.
no fault*
thanks florian
 
5:05 PM
I need a function in the PHP docs that returns void. Can anyone think of such a function?
 
sorry it was not cakephp or mysql fault. it was indeed my script fault. I was fetching posts in descending order but the comments associated with the posts were not sorted. they were as they appear in the mysql. I changed the id of my comments to an order but it didn't change the order my comments are stored in the database because when I downloaded the sql file and opened it in my texteditor I can see the actual order of fields. That was the reason behind all my problem.
 
@LeviMorrison var_dump
 
ah crap it's 17:09 and I just got up
 
5:10 PM
@AndreaFaulds Sounds like a perfect way to spend the caturday
 
Okay, it seems in DocBook we use <type>void</type> instead of <void />.
 
Also monring
 
... dat odd feeling, when you look outside and it is dark already
 
user895378
E_TOO_MUCH_NORTH
 
lol, you can go to sleep again after few hours :D
how to sort multidimensional array?
 
5:16 PM
@ShubhamNishad You should really learn how databases work
 
yeah, It's been just 1 month that i started learning these things
 
php, databases etc
I need to learn a lot as I go
I'm making a social network website to learn more about these subjects :)
 
@LeviMorrison will we be getting a void type?
 
NOOOOoooooooo........
 
5:22 PM
no? seems like a natural addition now that return types are there
 
I think that adding a new type is a big decision....it really needs to be justified by itself, rather than just being added as a side effect of adding return types. And can't see much use in a void type.
 
@PeeHaa wasn't good sleep tho
ANYWAY
Yes, Caturday.
 
I didn't realize there is such a thing as not a good sleep :P
 
5:48 PM
Oh man
Stas and Yasuo are panicking with the deadline for default ctors looming
@PeeHaa when you feel equally tired when you wake up, and your back hurts
 
I feel like I must be wrong about not wanting to support 'Foo::bar' callbacks
Why? Because Stas seems to agree with me ^^
@Danack Isn't a relatively large portion of functions void?
 
@NikiC Well, null in place of void.
 
@Danack ah, to clarify, supporting a "void" return type has nothing to do with adding a new type.
Or really, I have no idea what you're saying
 
I thought you meant an actual new type, that could be used: function foo(void &$bar) {}
 
no, that doesn't make sense
 
5:54 PM
@NikiC PHP should try to be intuitive, and we support only 'Foo::bar' in places
 
@AndreaFaulds Ah, there are places where array callbacks are not accepted?
I think it's pretty intuitive that method callbacks all use the same syntax. Instead of two different ones
 
@NikiC Not for callbacks per se, but I think it's worth pointing out that we use this approach for constants.
 
seems pretty unrelated
 
I don't see how.
 

« first day (1561 days earlier)      last day (3384 days later) »