How get you get element key and value of an at the n position array at a particular position without loop.
Imagine
$postion = 3; // get array at 3rd position
$array = array(
"A" => "Four",
"B" => "twp",
"C" => "three",
"D" => "Four",
"E" =>...
What you want is not possible. PHP's arrays have efficient access by key, but don't have efficient access by offset. The order is only available as a linked list, so the best efficiency you can hope for is an O(n) loop, which just goes through the array and looks for the offset.
If you want this...
@Gordon Well, if you have somewhere to live, life is cheaper than where I am and average salary is 300€, go figure. Do you have to pay taxes on that amount, or that is what you get?
In computer science, an array data structure or simply an array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula.
For example, an array of 10 integer variables, with indices 0 through 9, may be stored as 10 words at memory addresses 2000, 2004, 2008, … 2036, so that the element with index i has the address 2000 + 4 × i.
Because the mathematical concept of a matrix can be represented as...
How get you get element key and value of an at the n position array at a particular position without loop.
Imagine
$postion = 3; // get array at 3rd position
$array = array(
"A" => "Four",
"B" => "twp",
"C" => "three",
"D" => "Four",
"E" =>...
Assuming PHP 5.4, with array dereferencing:
echo $array[array_keys($array)[$position]];
In earlier versions you need to break it into two lines:
$keys = array_keys($array);
echo $array[$keys[$position]];
It would also be worth using the two-line approach in 5.4+ if you have to access multip...
Note: This answer assumes that you have some basic knowledge about how zvals work in PHP, in particular you should know what a refcount is and what is_ref means.
foreach works with all kinds of traversables, i.e. with arrays, with plain objects (where the accessible properties are traversed) and...
@Gordon 40% its damn high ... here its just like 10% - 20% - 30%(based on income and highest is 30%) and in part of india i leave medical is free completely
Hi guys. wow... Im reading about the salaries in colombia we are very far far away from that. Its a shame that I can't get a job in the states as a web developer because I don't have any college studies in that topic.
The highest tax wedges for single workers without children who are earning the average wage in their country were observed in Belgium (55.5%), Germany (49.8%) and Hungary and France (49.4%). The lowest tax wedges on the same basis were in Chile (7%), Mexico (16.2%) and New Zealand (15.9%) The average for OECD countries was 35.3%. Source: oecd.org/newsroom/…
@Gordon Good lord. And people say healthcare in the US is expensive. I used to pay 10% YEARS ago, but now it's down around 1.5%... For better coverage...
@NullPointer No, not me... My father in law worked for 40 years and only lived to get 3 years of pension because of the health system, to whom he paid 300€ a month.
@Jack nah, its not taxed yet. it basically lowers my income for that year by the amount i put into the pension. or something like that. german tax law ftw. not.
hi guys....i cloned windows 2003 server with xampp for windows......the apache is not started in the cloned one...where as in originalone it is running...what settings do i need to do in cloned one...
Those savings are then split over three buckets, health, special investment and the ordinary account (from which you can pay your mortgage for instance).
@NullPointer Eh, they pay out a pretty reasonable interest ... it's stable at least.
hi guys...i cloned the windows 2003 server...xampp for windows installed on it....in the original server apache is running...but in the cloned one...the apache is not running...still it is pointing to iis when i type localhost in the browser.....why? any ideas//////
@webarto was it you that was looking at trying to register gayqueery.com the other day? Seems like both exactly the sort of thing you would do and not at all the given the number of bastard jChildren you have
@Jack It just gets used to solve a problem that doesn't exist far too much. I understand the nice abstractions that make all those nasty cross-browser issues disappear, but people use it (badly) for all sort of things that work everywhere just fine without it. And it's DOM selectors are reeeeaaaaallllllyyyyy sssssllllllooooooowwww and while(1); resource hungry.
@Hamad Once you understand and know how to use the DOM, feel free to use jQuery for the fast development and simple abstractions it gives you. But until you understand how it works and what price you pay for using it, don't use it. IMO.
@Jack But that's just the thing. How many times to you see code with simple $('#id') or $('.className') or $('tagname') selectors - all things which have simple, optimised natives. And yes, querySelector(All) is a nice addition, but as usual it's not yet usable in the real world because M$ don't do it yet. Unless IE10 does it, I don't know.
@Hamad The same price you pay for any abstraction - increased overhead and often some terrible practices underneath (for ex. it uses way too much innerHTML for my liking). My biggest bugbare is the selectors though (see my last couple of comments) - they are really great for the complex stuff but insanely inefficient for the simple stuff you do 99% of the time.
Also because the constructor has so many ways of calling it, it takes a lot of unnecessary processing. And because when writing jQ code you call that constructor usually a few times in a single procedure, it can really stack up after a while
@ircmaxell It's a fair point. And you'll note I'm not saying "don't use jQuery" I'm just saying "don't use it until you understand it". And I also accept that many do not share my view on the matter, and they have their reasons, and that's fine.
@Hamad Indeed. It is absolutely true that you will (and probably should) care about those inefficiencies much less when the code is going to be executed on someone else's machine and it doesn't eat into your server load. But when you get to really complex and JS-heavy sites like Facebook you'll find they tend to steer clear of that kind of thing and write very tailor-made solutions, because when you are running that much JS it can really add up to a noticeable UX hit.
@BoltClock So it has, my mistake. It's a while since I read any docs for it, I note MDN state that it has limitations before IE9, I shall refresh myself on that matter
While jQuery advertises compliance with the Selectors level 3 standard on its home page, it does not fully implement the spec. In its own Selectors documentation, it clarifies that it "[borrows] from CSS 1–3, and then [adds] its own" selectors.1
Starting from jQuery 1.9, virtually all selectors ...
@Hamad I'm trying not to appear as if I'm trying to scare people away from it, I simply ask that people try and understand what they are using before they get so used to using it that they forget that they are using it (follow that? no, me neither) - if you look at the questions in jquery you'll see a lot of people who seem to think that Javascript is something separate and distinct, and that is the kind of thing that is dangerous IMO.