« first day (1948 days earlier)      last day (3224 days later) » 

00:01
@JoeWatkins I'm not comfortable presenting someone else's work as my own.
dat response time though: somoglobal.com
writing documentation is hard :(
00:28
@tereško hard or time consuming? Or both?
kinda both
/me is trying to document his routing lib
the moment I even started I realized that there are some part which might come off as "confusing"
@tereško Another Router? I feel like PHP got flooded with Routers since FastRoute ^^
I just decided to get my shit together and actually document it in case someone has the poor judgement to use it
and, @bwoebi, it uses a completely different style, if compared to FastRoute
@tereško yeah, just seeing. Wasn't comparing to FastRoute though… just noting that the Router number exploded since FastRoute had been introduced
also, the README.md is about 20% done :(
hehe .. that's true, but most of them are shit
and mine is actually older than FastRoute
00:34
yep^^
There was hordes of routers before FastRoute
@rtheunissen sure, but none which ever became popular in the slightest
and usually framework-bound
Fair call
/me is aiming to position mine as an alternative
:-D
00:38
ok .. that's bullshit
what I am actually aiming at is "nice looking github profile"
01:12
I can't decide which result I prefer: 3v4l.org/fIP56
@PaulCrovella well, abs() should be positive in any case… even it means conversion to float.
is it worth a note in the manual? current it says "If the argument number is of type float, the return type is also float, otherwise it is integer"
What do you think the chance would be for an RFC that generates a warning when an int is converted to float like this?
@PaulCrovella here, have a star
01:23
Hello, I am Galstaff, sorcerer of LIGHT!
I think the PHP7 way would cause less errors in long run
i try to test multithreading on php using pthread lib , but its not work att all
E_DOESNT_WORK is not really a useful error code
ahhhh ok , let me explain the problem
you also might end up waiting for any useful answer for 4+ hours, till @JoeWatkins wakes up
01:27
@Danack I think I'd rather see wiki.php.net/rfc/bigint revived
@PaulCrovella I dont think "having a bigger int" will help.
It would for that case......but I think there are still issues.
But maybe not insurmountable ones.
wouldn't PHP_BIGINT_MIN be still further from 0 than PHP_BIGINT_MAX?
plz see this example
class Test extends Thread {

public function run (){
require __DIR__'/../vendor/autoloade.php';

// extends some laravel class
}
}


$try = new Test();

$try->start();
autoloade
01:31
or would it return -INF and INF respectively?
i use laravel framework
@tereško depends on how they're implemented ;-)
@tereško according to the RFC, there would be a storage limit, that implies maximum values - which would be 'quite' large.
Kind of particles in the universe large.
wasn't it something like 2^32-1 digits?
if you used all the particles in the universe to store a number in binary, you shill would be able to store larger max-negative number than max-positive
01:33
after the start it seams that there is some classes and some var with null as value
@tereško in twos complements binary, sure
know its a context running probleme
but how can i solve it ????
plz hlp !
@bwoebi well, PHP still doesnt work on quantum processors ... you might need to open a ticket
@tereško though I'm not sure, if you have, whether you'll be able to store any arbitrary number
@PaulCrovella bottom line: PHP7 does the correct thing, HHVM goes full retard
01:36
the problem is just representing that number in something which can prove to us that this is indeed the correct number ;-)
But that's all in the probabilistic quantum realm…
when i create a new child thread it can't access to its parent resources and context !
any one can help me with any thing ?
01:57
@tereško if you're going to use all the particles in the universe to store a number in binary it may as well be unsigned - go big or go home
02:08
given an int $i = 5 and an generic class object with nothing but one property, $obj->i = ?5... how much more memory, if any, does the object use than the plain int
well, whatever it is, this is the best typo ever, to get this: "Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 6658419639556767776 bytes)"
:D
I don't think even google has so much ram .. or even disk space
it's only 6,000 petabytes. I'm sure google has that much.
enterprise HDDs are still mostly sub-10TB
.. that's 600'000+ hard drives .. adjusting for fault tolerance: about 1M
and million of real things is quite a lot
02:38
@tereško what-if.xkcd.com/63 estimates 10 exabytes
you could be correct
it's not like I actually made any calculations
/me goes back to writing docs
well, I figure, Google has more storage space that is conceivable, so when php tries to allocate 6 EB, it seems reasonable to conclude Google has more.
I'm not even sure what I would do with that much storage space.
Though I sure would like to know just what glitch caused PHP to try to allocate that, because I couldn't reproduce it.
@jbafford nothing
it would be "just there"
I'd sell it.
that's how I currently tread my 4TB drive
02:43
according to Wikipedia, "in the next decade, astronomers expect to be processing 10 petabytes of data every hour from the Square Kilometre Array (SKA) telescope.[14] The array is thus expected to generate approximately one exabyte every four days of operation."
it has let me stop worrying about "do I have enough space to download <thing>", I just add the torrent and let it be
I imagine the LHC generates a similar torrent of information.
I have switched from "deleting stuff to have space" to "deleting stuff to help finding useful things"
3
02:57
@Ocramius would you by chance know a really harsh automated code-review site for github projects?
Hi guys, anyone here has experience in writing PHP Code Sniffer standard? I want to force all the <?= open tags must follow a function call (like this <?= escape(...) ?>), but the T_OPEN_TAG seems not to capture the escape function name in it. Please help.
03:12
@TrungDQ check the following token
@PaulCrovella could you be more specific or is there a link I can read?
The $token object contains {"code":374,"type":"T_OPEN_TAG","content":"<?php","line":48,"column":17,"length‌​":6,"level":0,"conditions":[]}, I don't know how to get the "following" token. Google "php cs following token" wasn't give out useful information.
03:21
@TrungDQ You should probably ask on Reddit, which is not something I say often.
.. I would have just asked on SO and slapped on a bounty
CS might not be able to do it - as it's ensuring functions are in place, not that the tokens are arranged in a certain way.
@Danack thanks, I rarely active on reddit, but I'll try.
well, that's sad.
@TrungDQ a token describes a single syntactic unit, here is a list of parser tokens used in php (I'm guessing codesniffer reports them directly)... basically you want to scan until you get T_OPEN_TAG_WITH_ECHO (which indicates <?=) then grab the one immediately after that. I can't tell you exactly how to do that with codesniffer as I'm not familiar with its api, but that should be a start.
03:40
Thanks Paul, I'll have to look up the CS's api to find out how to get the next token. In the worst case I think I'm gonna write a standalone script for my business.
well, the very next might be whitespace (if it reports those) or comments, so iterate and skip stuff you don't care about
yeah, the next T_FUNCTION token, maybe.
oops, no, I mean function name
lol (xcom2 rookies)
T_STRING
 
1 hour later…
05:22
moin
Morning @JoeWatkins
Jay
Jay
hey guys
I got an issue was hoping someone could help me with
I have a php object
Array
(
    [0] => stdClass Object
        (
            [id] => 1
            [name] => Product name test
            [price] => 100.9900
            [slug] => product-name-test
        )

    [1] => stdClass Object
        (
            [id] => 2
            [name] => Product name test 2
            [price] => 34.9900
            [slug] => product-name-test-2
        )

)
@JoeWatkins Would you rather... vector/php_ds_vector_iterator.h alongside all the other vector stuff, or iterators/php_ds_vector_iterator.h alongside all the other iterators?
Jay
Jay
I want to run through the object and wrap a function around the price value
but keep the object the same
@Jay like array_map?
Jay
Jay
05:30
I made a custom function to format the price
I think you should use a class the product, rather than stdClass?
Jay
Jay
Its pyroccms framework
:S
Cool cool. What would you like to see
> run through the object and wrap a function
Jay
Jay
How I can wrap a number_format() function around the price value
but keep this object the same
What do you mean by wrap around?
You could array_map the array, and apply the function to each object?
Jay
Jay
05:33
number_format(100.9900)
@rtheunissen keeping iterators in one place might be smart
also moin
@JoeWatkins feeling well now?
Jay
Jay
really stuck
hows Emma and Lewis?
slept for 5 hours last night ... about normal ...
off school for a week, so probably plotting ways to make my life difficult ...
05:36
Thanks, will do
Jay
Jay
@rtheunissen you think its possible?
@Jay absolutely, if I understand correctly.
Try combine array_map with your custom function
Jay
Jay
basically that object needs to be looped through and the price value needs to be number_formatted
@JoeWatkins owww all the best :D
Jay
Jay
Just the price
no other valsues
05:40
@JoeWatkins the result of this refactor is going to be so damn nice. I can feel it.
Jay
Jay
@rtheunissen would you mind showing me a sample?
@Jay you have an array of objects.
So use array_map to step through that array, and return a modified version of each object in the callback.
Again, if I understand correctly.
@rtheunissen yay :D
Jay
Jay
@rtheunissen This is what I want to do
foreach($products as $product){
			echo number_format($product->price);
		}
$products is that string above
But I want to keep the same format
What format exactly?
05:46
welcome @Ekin
o/
hi everyone :D
quick question im trying to recall a php file in a function but it crashes my website heres the function ive wrote but i think im recalling the php file wrong what is the correct way?
function woo_simfree_product_tab_content() {

// The new tab content

/wp-content/themes/wootique-child/custom-groups/grouped-simfree.php

}
Jay
Jay
@rtheunissen
$i = 0;
		foreach($products as $product){

			$products[$i]->price = number_format($product->price);
			$i++;
		}
This worked
But is it the best way
That actually modified "product". Is that the intention or would you prefer to not modify it?
Did you take a look at array_map?
Jay
Jay
I just wanted to modify the Price only
05:52
@Jay what you trying to do?
Jay
Jay
I am using pyrocms
The $products = the built in pagination
what is the correct way to fetch a php file, is it echo, return.. ? etc?
@Jay This works:
foreach ($products as $product) {
    $product->price = number_format($product->price);
}
Jay
Jay
nice man thanks
@rtheunissen :)
05:55
welcome @GauravSrivastava
Hello guys, if I have two arrays
$arr1 = ["one","two","three",1,2,3];
$arr2 = ["two","four","five",2,4,5];
how do I get another array $arr = ["one","two","three","four","five",1,2,3,4,5] from these two array.

I know how to do it but I just want to know if there is any built in method for greater efficiency?
<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>
^ that
05:58
@Scott, nah it will return the common element twice
like "two" will there 2 times
taken from the manual here ... php.net/manual/en/function.array-merge.php
@ShubhamNishad you could do like 3v4l.org/8n8ng
don't know if there's one function that combines array_merge & array_unique
@Ekin, thanks.
I was doing it this way
<?php
$arr1 = ["one","two","three",1,2,3];
$arr2 = ["two","four","five",2,4,5];

foreach($arr2 as $arr){
if(!in_array($arr, $arr1)){
array_push($arr1, $arr);
}
}
var_dump($arr1);
array_unique(array_merge($a1,$a2)); looks quite elegant though
Jay
Jay
06:03
I used the array_walk
such a greatb function
once again thanks guy
love you
0
A: How to share global variable across thread in php?

Joe WatkinsOrdinarily, threads are executed in the same address space as the process that started them. So, in C, the new threads are able to directly access variables on the stack of the main program. When you create a new thread in PHP, it has a separate heap, it must execute in a separate address space...

me, saying stuff ...
how can I open a seperate php file in a tab from a function what is the recall method ive tried return("/path/to/file.php), echo, fopen why isn't the file loading?
function woo_simfree_product_tab_content() {

// The new tab content (known to crash website if not recalled correctly)

return "/wp-content/themes/wootique-child/custom-groups/grouped-simfree.php";

}
good stuff @JoeWatkins
06:28
good morning
user924016
06:52
moin o/
'ning @RonniSkansing
07:07
welcome @HimanshuAgarwal
@SagarNaliyapara thank you
Jay
Jay
anyone know where I can get an xml file with the current currency rates in?
07:22
@Jay From what to what? or currency rate compared to what currency?
morning btw :)
Jay
Jay
GBP being 1
is there a file with GBP being rate 1 and all the others are converted based on that?
moin @Naruto !!
Jay
Jay
07:26
@Naruto Thanks alot mate
np, what google can do for you ;)
Jay
Jay
haha
Anonymous
@Jay the amount of notifications I woke up to this morning scared the shit out of me.
Jay
Jay
haha @jay
Like I said before I am the Original haha
Sharing is caring
ha ha ha @GourabNag
Jay
Jay
I am stucxk again :(
[item] => Array(
    [0] => Array(
        [title] => 1 GBP = 1.45107876 USD
        [link] => floatrates.com/gbp/usd
        [description] => 1 U.K. Pound Sterling = 1.45107876 U.S. Dollar
        [pubDate] => Mon, 15 Feb 2016 00:00:01 GMT
        [baseCurrency] => GBP
        [baseName] => U.K. Pound Sterling
        [targetCurrency] => USD
        [targetName] => U.S. Dollar
        [exchangeRate] => 1.45107876
    )

    [1] => Array(
        [title] => 1 GBP = 1.28656540 EUR
        [link] => floatrates.com/gbp/eur
Would anyone be so kind as to tell me how to get this array with the targetCurrency as the array key?
so it would be:
[item] => Array(
    [USD] => Array(
        [title] => 1 GBP = 1.45107876 USD
        [link] => floatrates.com/gbp/usd
        [description] => 1 U.K. Pound Sterling = 1.45107876 U.S. Dollar
        [pubDate] => Mon, 15 Feb 2016 00:00:01 GMT
        [baseCurrency] => GBP
        [baseName] => U.K. Pound Sterling
        [targetCurrency] => USD
        [targetName] => U.S. Dollar
        [exchangeRate] => 1.45107876
    )

    [EUR] => Array(
        [title] => 1 GBP = 1.28656540 EUR
or even better:
[item] => Array(
    [USD] => 1.45107876
    [EUR] => 1.28656540
)
Hi guys, Please check out my question.
2
Q: Implode input field in li tags

Vintage BeefI want to display input using implode like: My code : $qty = array('2', '2', '1'); $price = array('200', '400', '1000'); $subtotal = array('400', '800', '1000'); echo "<li> Quantity: <input type='text' class='qty' name='qty' value='".implode("'> Quantity: <input type='text' class='qty' name='...

07:49
Morning.
hello, would just like to ask what is the best software for CMS
Does anyone have any idea for my question? Really need help. :(
@VintageBeef bro are you trying to implode or explode?
Implode.
08:00
@VintageBeef yuck! why are you doing that?
Why?
My code was wrong?
use a foreach instead...
Yes, On my php I've used that.
On my question just for test
make your array look like:
$data = array(
    array('qty' => 2, 'price' => 200, 'subtotal' => 400),
    array('qty' => 2, 'price' => 400, 'subtotal' => 1000),
    array('qty' => 1, 'price' => 800, 'subtotal' => 1000));
On my php:
function getVendors() {
foreach($_SESSION["products"] as $product) {
$price = $product["product_qty"] * $product["p_discount"];
$org[$product["member_display_name"]]['product'][] = $product["p_name"];
$org[$product["member_display_name"]]['discount'][] = $product["p_discount"];
$org[$product["member_display_name"]]['qty'][] = $product["product_qty"];
$org[$product["member_display_name"]]['subtot'][] = $price;

}
return (!empty($org))? $org : array();
}

foreach(getVendors() as $vendor => $prods) {
08:06
please, use pastebin or gist...
foreach(getVendors() as $vendor => $prods) {
    print("<li>");
    printf("Quantity: <input type='text' class='qty' name='qty' value='%s' />", $prods['qty']);
    printf("Price: <input type='text' class='price' name='price' value='%s' />", $prods['discount']);
    printf("Subtotal: <input type='text' class='subtot' name='subtot' value='%s' />", $prods['subtot']);
    print("</li>");
}
@VintageBeef was talking about something like ^^
08:28
Morning 11
Thank you so much.
oh, he asked in here, too. adds to my help vampire theory
Wes
Wes
08:50
what's your vampire theory? :P
@Andrea congratulations, but please know that each time someone uses the constructor example, somewhere a rainbowunicornkitten dies ;)
@Wes that guy got an answer to his question with a for loop and he asked the op to provide a foreach loop instead.
Wes
Wes
@Gordon yeah list() has its uses but that is bad
Jay
Jay
yo
say I have an array like this:
[0] => 1, [1] => 4, [2] => 18
Whats the best way to remove the value only if it contains 1?
if it contains a 1? as in index 0 and 2 would both have to be removed in your example ?
Jay
Jay
08:59
the array value

« first day (1948 days earlier)      last day (3224 days later) »