Associative array call with a math expression inside doublequotes vs singlequotes

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
admin
Site Admin
Posts: 66094
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by admin »

Yes, I think that's expected for sorting by Index.

But here's an idea: What about secondary sort by Index descending!? This can even be stored in Folder View Settings. Forget it, it just works when sorting by Type or Ext.

admin
Site Admin
Posts: 66094
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by admin »

highend wrote: 12 Jul 2024 14:08 An inbuilt <cc_index> would be nice (could use this as well)...
Tried it but failed: Can't be done in a performant way.
Well, maybe I did it. Try next beta... :)

admin
Site Admin
Posts: 66094
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by admin »

@Brano:

In your foreach loop also quote the index here:

Code: Select all

$a[quote($i)] = $counter;
Otherwise you get problems with folders called "20240712" (high numbers).

But, of course, the script is very inefficient anyway. Check out <cc_index> in the next beta.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by Brano »

Wow, great news! :-) Thanks.

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by Brano »

admin wrote: 12 Jul 2024 14:03 Folder and files can mix if you sort by Index.
Ahh...ok, I see now how it works. It cannot be subtracted from the subfolder count. It was just my testing directory that way. But nevertheless, with the <cc_index> it works. I am using just
<cc_index> and
-<cc_index>

The numbers are not sequential but that is just a cosmetic.

admin
Site Admin
Posts: 66094
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by admin »

So the speed is there now?

Brano
Posts: 38
Joined: 08 Jul 2024 11:52

Re: Associative array call with a math expression inside doublequotes vs singlequotes

Post by Brano »

Yes, I haven't noticed any lag with 1000 subfolders. Thanks.

Post Reply