Today, I need to figure out what path a symbolic link was pointing to.

To do this in PHP, you can use the readlink function:

$symlink = '/path/to/symlink';

$target = readlink($symlink);

if ($target !== false) {
    echo "The target of the symlink is: $target";
} else {
    echo "Failed to read the target of the symlink.";
}

If you want to get the absolute path, you can use the realpath function:

$symlink = '/path/to/symlink';

$target = readlink($symlink);

if ($target !== false) {
    $absolutePath = realpath($target);
    echo "The absolute path of the target is: $absolutePath";
} else {
    echo "Failed to read the target of the symlink.";
}

To do the same in Elixir, you can use the File.read_link/1 function:

symlink_path = "/path/to/symlink"

case File.read_link(symlink_path) do
  {:ok, target} ->
    IO.puts("The target of the symlink is: #{target}")

  {:error, reason} ->
    IO.puts("Failed to read the symlink target: #{:file.format_error(reason)}")
end

To get the absolute path in Elixir, use the Path.expand/2 function:

symlink_path = "/path/to/symlink"

case File.read_link(symlink_path) do
  {:ok, target} ->
    absolute_path = Path.expand(target, Path.dirname(symlink_path))
    IO.puts("The absolute path of the symlink target is: #{absolute_path}")

  {:error, reason} ->
    IO.puts("Failed to resolve the symlink target: #{:file.format_error(reason)}")
end