PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 5, 2022

[FIXED] How to retrieve all available environment variables?

 November 05, 2022     environment-variables, ocaml     No comments   

Issue

Is there a way in OCaml to retrieve all available environment variables?

The OCaml stdlib provides the following in the Sys module:

val getenv : string -> string

But it only show if an env var is available. Is there a way to list all variables in the environment?


Solution

You need to use Unix.environment from the unix library (distributed with the OCaml system). Example:

>   ocaml unix.cma
        OCaml version 4.03.0

# Unix.environment ();;
- : string array = ...


Answered By - Daniel Bünzli
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing