Brian Dunning's FileMaker Custom Functions

phpArrayValue ( array ; key ; pos )

This will get the key and value from a php array.

  Average rating: 4.7 (25 votes) Log in to vote

Todd Dignan   Todd Dignan
Dignan Consulting Inc
http://dignanconsulting.com

Share on Facebook Share on Twitter

  Sample input:
phpArrayValue ( $array_list ; "[cc_owner]" ; 0 )
  Sample output:
[cc_owner] => todd dignan

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This return the key and value of a php array.
array = php array (example of a php array:
[cc_type] => Visa
[cc_owner] => todd dignan
)
key = the key in the array or the name of the value.
pos = always equals 0

You will need to also use the custom function "SuperTrim" http://www.briandunning.com/cf/904

I also use this to get just the value.

Let(
[
text = phpArrayValue ( $array_list ; "[cc_owner]" ; 0 );
start = Position ( text ; "=>" ; 1 ; 1 )+3;
number = Length(text);
result = Middle ( text ; start ; number )
];
If(result = "";""; result)
)

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: