Arrays: new and old keys, i
JimAultWins at yahoo.com
Sun Sep 14 03:34:46 CDT 2008
On 9/13/08 10:38 PM, "Dick Kriesel" <dick.kriesel at mail.com> wrote:
> Maybe the benefit of unsorted keys is faster execution. Why wait for a sort
> if you don't need it?
I believe the logic in the realm of PHP and web pages and databases are
often-used functions such as
explode(' ',explode(',', expolode('|', $textBlock)))
implode, array_walk, list
--multiple arrays from one table (2 nested lists)
list(list($tl,$tr),list($bl,$br)) = $matrix;
list, coupled with while, makes for a handy way to populate arrays.
while (list($repcnt, $replnk, $date) = mysql_fetch_row($seek0))
to do it associative (if your array isn't numeric), is to just use
array_values like this:
$os = array();
$os["main"] = "Linux";
$os["distro"] = "Ubuntu";
$os["version"] = "7.10";
list($main, $distro, $version) = array_values($os);
Where many arrays are populated with incoming data, then converted or
decoded depending on the source and destination. In this scenario,
separate arrays will have the same sequence, thus an implied linking so they
can be recombined.
"The 10th element of each array is the 10th row of a data table where the
arrays are columns or groups of columns"
Common web tasks are adjusting dates, times, time zones, html entities,
special chars, character sets, UTF8, UTF16, url's, etc.
Since Html, Xml, etc reuse the same tag names and attributes, order of
appearance and nesting are critical for refactoring content and presentation
code. Microsoft Word does not assign an ID to each paragraph, but
maintaining the sequence is still critical. Decoding, parsing, and
re-encoding such content is much smoother and faster if the order is
maintained until the programmer chooses to sort/delete/add elements, or add
> On 9/13/08 10:25 PM, "Ken Ray" <kray at sonsothunder.com> wrote:
>>> That would do me - except the most useful would be the ability to get the
>>> full ordered index.
>>> put the ordered keys of theDataA
>>> Because you want to things like:
>>> repeat for each key sortedKey in theDataA
>> I've been watching this thread and I have to ask:
>> "What benefit is it to the Rev developer (not the engine) to have the keys
>> NOT sorted?"
>> I mean, I understand why the *engine* may want to keep the keys in a special
>> order, but every time I work with the keys of an array, either (a) I don't
>> care what order they're in, or (b) I really want them sorted. Personally,
>> I've never WANTED to have the keys in an unsorted order...
>> Ken Ray
>> Sons of Thunder Software, Inc.
>> Email: kray at sonsothunder.com
>> Web Site: http://www.sonsothunder.com/
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the use-livecode