php/WP_CLI/Runner.php
private static function extract_subdir_path( $index_path ) {
		$index_code = file_get_contents( $index_path );

		if ( ! preg_match( '|^\s*require\s*\(?\s*(.+?)/wp-blog-header\.php([\'"])|m', $index_code, $matches ) ) {
			return false;
		}

		$wp_path_src = $matches[1] . $matches[2];
		$wp_path_src = Utils\replace_path_consts( $wp_path_src, $index_path );

		$wp_path = eval( "return $wp_path_src;" ); // phpcs:ignore Squiz.PHP.Eval.Discouraged

		if ( ! Utils\is_path_absolute( $wp_path ) ) {
			$wp_path = dirname( $index_path ) . "/$wp_path";
		}

		return $wp_path;
	}
private static function extract_subdir_path( $index_path ) {
		$index_code = file_get_contents( $index_path );

		if ( ! preg_match( '|^\s*require\s*\(?\s*(.+?)/wp-blog-header\.php([\'"])|m', $index_code, $matches ) ) {
			return false;
		}

		$wp_path_src = $matches[1] . $matches[2];
		$wp_path_src = Utils\replace_path_consts( $wp_path_src, $index_path );

		$wp_path = eval( "return $wp_path_src;" ); // phpcs:ignore Squiz.PHP.Eval.Discouraged

		if ( ! Utils\is_path_absolute( $wp_path ) ) {
			$wp_path = dirname( $index_path ) . "/$wp_path";
		}

		return $wp_path;
	}
private static function extract_subdir_path ( $ index_path ) { $ index_code = file_get_contents ( $ index_path ) ; if ( ! preg_match ( '|^\s*require\s*\(?\s*(.+?)/wp-blog-header\.php([\'"])|m' , $ index_code , $ matches ) ) { return false ; } $ wp_path_src = $ matches [ 1 ] . $ matches [ 2 ] ; $ wp_path_src = Utils \ replace_path_consts ( $ wp_path_src , $ index_path ) ; $ wp_path = eval ( "return $wp_path_src;" ) ; // phpcs:ignore Squiz.PHP.Eval.Discouraged if ( ! Utils \ is_path_absolute ( $ wp_path ) ) { $ wp_path = dirname ( $ index_path ) . "/$wp_path" ; } return $ wp_path ; }
Attempts to find the path to the WP installation inside index.php

@param string $index_path
@return string|false
Attempts to find the path to the WP installation inside index . php