php – Plugin/theme relative PATH/URI

Just don’t do it, you can never know if the plugins directory is even “below” ABSPATH, and you can not know the URL out of the directory path https://codex.wordpress.org/Determining_Plugin_and_Content_Directories.

Just use the core api of plugins_utl etc, don’t reinvent the wheel.