Jump to content


Popular Content

Showing content with the highest reputation on 04/06/2018 in all areas

  1. 1 point
    The problem is in the function name 'strpos' being at the beginning, the position will be 0, so 0 will be treated as false. The position of needle text placed anywhere but the beginning will be greater than 0, meaning true. You need to check against not being false within the if condition and make sure you use !== compared to != with single equals symbol. http://php.net/manual/en/function.strpos.php
  2. 1 point
    No, that adds a new item to the array. The new item is an array with 1 item in it, "trackPageView". So, if _paq was an empty array, then _paq[0][0] would be "trackPageView". trackPageView is a value, not a key. Those are both values, not keys. That is an array with 2 values being added to _paq. Values listed in an array are separated by commas. Technically, Javascript does not have arrays with string keys, all array keys are numeric. But since everything in Javascript is technically an object, even an array, then you can represent an array as an object structure where the property names are strings. You can refer to those using either array or object syntax. No, that's getting the first script tag on the page, so it assumes there's at least one. getElementsByTagName returns a collection of elements, so it's getting the first element in that collection. Later it uses that script element as the reference to insert the new one. It would look like this: <script type="text/javascript" async="true" defer="true" src="value_of_variable_u/piwik.js"></script> Note that the entire function expression needs to be wrapped in parentheses: (function expression)();