Photovoltaic (PV) arrays can be connected following regular or irregular connection patterns to form regular configurations (e.g., series-parallel, total cross-tied, bridge-linked, etc.) or irregular configurations, respectively. Several reported works propose models for a single configuration; hence, making the evaluation of arrays with different configuration is a considerable time-consuming task. Moreover, if the PV array adopts an irregular configuration, the classical models cannot be used for its analysis. This paper proposes a modeling procedure for PV arrays connected in any configuration and operating under uniform or partial shading conditions. The procedure divides the array into smaller arrays, named sub-arrays, which can be independently solved. The modeling procedure selects the mesh current solution or the node voltage solution depending on the topology of each sub-array. Therefore, the proposed approach analyzes the PV array using the least number of nonlinear equations. The proposed solution is validated through simulation and experimental results, which demonstrate the proposed model capacity to reproduce the electrical behavior of PV arrays connected in any configuration.