@bwoebi i don't fully get the big O notation so i'm asking, in an array (not a php array) is it correct to say that "the remove operation runs in O(n) where n is count($list) - $index"?
So I'm working on this drupal site I inherited and I'm trying to understand how webform templates work. It says you have to create a new file with the naming format webform-form-[nid].tpl.php where nid is the node id of the form. Well, we have a dev, test, and prod environment. Isn't the nid going to be different in each?
@bwoebi i don't fully get the big O notation so i'm asking, in an array (not a php array) is it correct to say that "the remove operation runs in O(n) where n is count($list) - $index"?
array = like vector/arraylist in java, ie that shifts elements to left when removing automatically
[internals] ok, so, hopefully last question for a minute. How could I, from a zend_extension, after doing compile-time stuff with an op_array (handler), stop the script from executing? How do I just say, "We're done here" without forcefully terminating the program?
@NikiC Basically, nearly all opcodes where we fill in a refcounted return variable are susceptible to leaking if one of the operands (if it's refcounted) in case freeing the operand can trigger an exception.
because when we do ZEND_VM_CONTINUE_CHECK_EXCEPTION(); we do not verify whether there was an exception and conditionally free the return value. Doing this would anyway have too much overhead. So we need to free the return value somehow in the ZEND_HANDLE_EXCEPTION opcode … but … when we do ZEND_VM_CONTINUE_CHECK_EXCEPTION() and the operand has a return value, the return value is actually always set. If we do HANDLE_EXCEPTION() in these opcodes, the return value usually is not yet set.
@NikiC ^ thus we need to set the return value (in order to avoid undefined behavior and possible segfaults) before
Like e.g. in this snippet try { new class { function __toString() { return "a"; } function __destruct() { throw new Error; } } . "foo"; } catch (Error $e) {}, looking at ZEND_CONCAT: the operation is done, then FREE_OP1(); FREE_OP2(); and ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); and nothing is freeing the return value…
just want to know if what i'm saying is correct :B
Also bob "The add operation runs in amortized constant time, that is, adding n elements requires O(n) time." add refers to insert here, which is shift to right all elements that have >= $index. how is that constant time? :\
@Wes I am parsing a file whose encoding is always the same. Not sure what it is though. And I am comparing the string from said file with a string from a config file I created.
My current hypothesis is that I should use a csv reading library that lets me declare the encoding of the file I am trying to read, like this one: csv.thephpleague.com
Using PHP5 (cgi) to output template files from the filesystem and having issues spitting out raw HTML.
private function fetch($name) {
$path = $this->j->config['template_path'] . $name . '.html';
if (!file_exists($path)) {
dbgerror('Could not find the template "' . $name . '" in ...
This reference question has been frustrating me for a while: Reference - What does this symbol mean in PHP?
I'm not opposed, in general, to creating reference Q&As that are just link collections, especially about symbols. The What does this regex mean reference question is, in my opinion, the si...