Get only one Variable from PHP

Hi All

I want to get only one Variable from a PHP MySQL-Statement to a String in Android.
I have write a function:

private fun getLastID() {
var lastID: String? = null
            val queue = Volley.newRequestQueue(this)
            val url = ""

            // Request a string response from the provided URL.
            val stringRequest = StringRequest(
                Request.Method.GET, url,
                { response ->
                    lastID = response
                { lastID = "Fail!" })


How i can use the string “lastID” outside of this Function in my Project?
All Results show’s “null”, but if i make a Toast inside th Function, the Result is “42”.