
209 P.3d 179 (2009)
NEW SUN BUSINESS PARK, LLC, an Arizona limited liability company; Colfred Ranch, LLC, an Arizona limited liability company, Plaintiffs/Appellants,
v.
YUMA COUNTY, Arizona, a political subdivision of the State of Arizona; Monty Stansbury, in his capacity as Director of Yuma County Department of Development Services; Sharon Williams, in her capacity as Yuma County Zoning Enforcement Hearing Officer, Defendants/Appellees.
No. 1 CA-CV 08-0094.
Court of Appeals of Arizona, Division 1, Department E.
May 5, 2009.
*180 Law Offices of Larry W. Suciu, PLC By Larry W. Suciu, Barry L. Olsen, Yuma, Attorneys for Plaintiffs/Appellants.
Yuma County Attorney's Office, By Edward P. Feheley, Deputy County Attorney, Yuma, Attorneys for Defendants/Appellees.

OPINION
GEMMILL, Judge.
¶ In this appeal we address whether the county zoning inspector and deputy county zoning inspectors of Yuma County ("the County") were lawfully appointed within the meaning of Arizona Revised Statutes ("A.R.S.") section 11-808 (2001). We hold that the county zoning inspector was properly appointed, the deputy zoning inspectors must be appointed by the County Board of Supervisors ("Board"), and the actions of the deputy zoning inspector involved in this matter were valid because he was acting as a de facto deputy zoning inspector. We therefore affirm the judgment in favor of the County.

BACKGROUND
¶ 2 In 2007, complaints were filed against New Sun Business Park, LLC, and Colfred Ranch, LLC (collectively "Appellants") for alleged zoning violations. All of the complaints against Appellants were issued by Ron Van Why, a deputy zoning inspector for the Yuma County Department of Development Services. Appellants filed a complaint in superior court, requesting (1) a writ of mandamus directing the County to cease from proceeding against Appellants on the alleged zoning violation complaints until the County complies with A.R.S. § 11-808(A) and (2) a declaratory judgment that the Board failed to comply with A.R.S. § 11-808(A) before proceeding with alleged zoning violations against Appellants.
¶ 3 The trial court issued Appellants' requested writ, and in response, the County filed a motion to dismiss. After a hearing on the County's motion, the trial court entered judgment granting the County's motion to *181 dismiss Appellants' complaint. Appellants timely appeal, and we have jurisdiction pursuant to A.R.S. § 12-2101(B) (2003).

ANALYSIS
¶ 4 In its order, the trial court stated that it was "granting [the County's] motion to dismiss [Appellants'] Complaint." However, because both parties presented matters extrinsic to the pleadings, and because the trial court considered these matters in its ruling, we treat the ruling as one granting summary judgment. See Blanchard v. Show Low Planning & Zoning Comm'n, 196 Ariz. 114, 117, ¶ 11, 993 P.2d 1078, 1081 (App.1999). "In reviewing a decision on a motion for summary judgment, we determine de novo whether any genuine issues of fact exist and whether the trial court erred in its application of the law." Maycock v. Asilomar Dev., Inc., 207 Ariz. 495, 498, ¶ 14, 88 P.3d 565, 568 (App.2004). We apply a de novo standard of review to issues of statutory interpretation. City of Phoenix v. Harnish, 214 Ariz. 158, 161, ¶ 6, 150 P.3d 245, 248 (App.2006). We will affirm a summary judgment if it is correct for any reason. Hawkins v. State, 183 Ariz. 100, 103, 900 P.2d 1236, 1239 (App. 1995).

The County Zoning Inspector Was Duly Appointed in 1995 and Remained Lawfully in Office After the 2006 Amendments
¶ 5 Appellants first argue that under § 11-808(B), the County is precluded from enforcing its zoning ordinances because the County failed to properly establish and fill the position of county zoning inspector pursuant to § 11-808(A). The pertinent statutory provisions provide:
A. The county zoning ordinance shall provide for its enforcement within a zoned territory by means of withholding building permits, and for such purposes may establish the position of county zoning inspector, and such deputy inspectors as may be required, who shall be appointed by the board.

B. From and after the establishment and filling of the position, it shall be unlawful to erect [any] ... structure within a zoning district covered by the ordinance without first obtaining a building permit from the inspector....
A.R.S. § 11-808(A), (B) (emphasis added).
¶ 6 In 1995, the Board approved the "appointment of Monty M. Stansbury to the Regular, Full-Time position of Planning and Zoning Director for the Department of Development Services/Planning and Zoning." At that time, the following county ordinance, entitled "Section 401.00  County Zoning Inspector," was in effect: "The Yuma County Planning Director is the County Zoning Inspector, who together with Deputy Zoning Inspectors shall enforce the provisions of these regulations." (Emphasis added.) Thus, the County established and filled the position of county zoning inspector within the meaning of § 11-808 when it appointed Stansbury. As county planning and zoning director, he also served as the county zoning inspector. The next question is whether his appointment in 1995 remained valid in 2007 when the zoning violation complaints against Appellants were issued.
¶ 7 In September 2006, the County amended its ordinances to replace the former "Section 401.00  County Zoning Inspector" with an unrelated ordinance pertaining to manufactured homes.[1] In amending § 401.00, however, the County did not include in the 2006 ordinances a provision relating to the position of the county zoning inspector. Based upon the deletion of the former § 401.00, Appellants argue that the actions "taken by the Board in 1995 were erased in 2006 when the 1995 ordinance was replaced with the 2006 ordinance." We disagree.
¶ 8 We do not believe the 2006 amendment of § 401.00 divested the appointment of Stansbury. In 1995, the Board appointed Stansbury to the position of county planning and zoning director, and by virtue of § 401.00 the Board thereby also appointed Stansbury to the position of county zoning inspector. The mere act of amending § 401.00 does not have the effect of nullifying *182 the hiring decision and appointment made by the Board in 1995. Based upon the record before us, the County did not transfer the duties of the county zoning inspector to another person or position when it passed the 2006 amendments. Nor did the County repeal its zoning ordinances. Rather, it appears that the County intended Stansbury to continue to serve as the county zoning inspector, and the 2006 amendment to § 401.00 did not disturb this intention. See Johnson v. Frohmiller, 57 Ariz. 507, 512, 115 P.2d 244, 246 (1941) (holding that although statute creating office of state dairy commissioner was repealed, statutes relating to regulation of dairy industry were not repealed and the duties of the dairy commissioner were not expressly transferred to other officers, and thus state dairy commissioner continued to hold office during term of the governor who appointed him).
¶ 9 This conclusion is supported by A.R.S. § 1-251 (2002): "A person who at the time an act takes effect holds office under a law repealed by such act continues to hold the office according to the tenure of the law repealed, unless the duties of the office are expressly transferred to some other office." Even though county ordinances are not the equivalent of state statutes, we believe § 1-251 provides a guiding principle here.
¶ 10 We therefore hold that the Board properly appointed Stansbury as the county zoning inspector in accordance with A.R.S. § 11-808(A) in 1995, and the 2006 amendment of § 401.00 did not alter this appointment.

A.R.S. § 11-808(A) Requires Deputy Zoning Inspectors to be Appointed by the Board
¶ 11 Appellants next argue that the County is precluded from pursuing enforcement of the alleged zoning violations because Ron Van Why, the deputy zoning inspector who issued the complaints, was not appointed by the Board. Appellants contend that under § 11-808(A), both the county zoning inspector and all deputy inspectors must be appointed by the Board. The pertinent portion of A.R.S. § 11-808(A) provides: "... and for such purposes may establish the position of county zoning inspector, and such deputy inspectors as may be required, who shall be appointed by the board." (Emphasis added.) We agree that this language requires that deputy zoning inspectors as well as the county zoning inspector be appointed by the Board.
¶ 12 "Our goal in interpreting statutes is to determine and apply the legislature's intent." Morgan v. Carillon Invs., Inc., 207 Ariz. 547, 549, ¶ 7, 88 P.3d 1159, 1161 (App.2004). When determining the meaning of a statute, we first look to the plain language of the statute as the most reliable indicator of its meaning. Nordstrom, Inc. v. Maricopa County, 207 Ariz. 553, 556, ¶ 10, 88 P.3d 1165, 1168 (App.2004). "To assist in determining the legislative intent, we may also consider the statute's context, language, subject matter, historical background, effects and consequences, spirit and purpose." Garden Lakes Cmty. Ass'n, Inc. v. Madigan, 204 Ariz. 238, 241, ¶ 14, 62 P.3d 983, 986 (App. 2003). We must strive to give effect to each word of the statute. Guzman v. Guzman, 175 Ariz. 183, 187, 854 P.2d 1169, 1173 (App. 1993).
¶ 13 Section 11-808(A) may be susceptible of two interpretations. It is not entirely clear on the face of the statute whether the words "who shall be appointed by the board" refer only to the county zoning inspector or also to deputy inspectors.[2] We have considered the context, language, subject matter, and surrounding statutes of § 11-808(A) as well as the arguments of the parties and the ruling of the trial court. The County argues that it is most logical and reasonable that only the county zoning inspector must be appointed by the Board of Supervisors. Based on the language and sentence structure, however, we conclude that the deputy inspectors must also be appointed by the Board.
¶ 14 The sequence of the clauses persuades us. The clause "such deputy inspectors as may be required" immediately precedes "who shall be appointed by the board." Based on this language and structure, we believe the *183 requirement of Board appointment logically applies not only to the county zoning inspector but also to the deputy inspectors.
¶ 15 The "last antecedent rule" supports our interpretation of § 11-808(A). "The last antecedent rule is recognized in Arizona and requires that a qualifying phrase be applied to the word or phrase immediately preceding as long as there is no contrary intent indicated." Phoenix Control Sys., Inc. v. Ins. Co. of N. Am., 165 Ariz. 31, 34, 796 P.2d 463, 466 (1990). In this case, the qualifying phrase is "who shall be appointed by the board." Applying this qualifying phrase to the immediately preceding reference to "such deputy inspectors as may be required" supports the conclusion that deputy zoning inspectors must be appointed by the Board.[3]
¶ 16 In addition, to reach the conclusion that the Board need appoint only the county zoning inspector, one must essentially rewrite the language of § 11-808(A). That is, to adopt the County's preferred interpretation, one must move the "who shall be appointed by the board" clause so that the pertinent language of § 11-808(A) would be: "and for such purposes may establish the position of county zoning inspector, who shall be appointed by the board, and such deputy inspectors as may be required." Our Legislature did not choose this particular language, however, and we are "not at liberty to rewrite the statute under the guise of judicial interpretation." See State v. Patchin, 125 Ariz. 501, 502, 610 P.2d 1062, 1063 (App. 1980). Indeed, "it is not the function of the courts to rewrite statutes. The choice of the appropriate wording rests with the Legislature, and the court may not substitute its judgment for that of the Legislature." City of Phoenix v. Butler, 110 Ariz. 160, 162, 515 P.2d 1180, 1182 (1973) (citation omitted).
¶ 17 We recognize that our interpretation of A.R.S. § 11-808(A) may not be the most expedient for the Board. The County argues that it is unaware of any other analogous deputies who are required to be Board appointed. We are guided by the statutory language, however, rather than by convenience or expediency. The County's arguments may be addressed to the Legislature if desired.
¶ 18 We therefore interpret § 11-808(A) to mean that both the county zoning inspector and the deputy zoning inspectors must be appointed by the Board.

Deputy Inspector Van Why Acted as a De Facto Deputy Zoning Inspector
¶ 19 We next address the validity of the complaints issued by Ron Van Why against Appellants. Van Why was not appointed by the Board. Rather, he was hired by Stansbury, the county zoning inspector. In accordance with our interpretation of A.R.S. § 11-808(A), the hiring of Van Why did not comply with the § 11-808(A). Nevertheless, the complaints issued by Van Why against Appellants are valid because Van Why was acting as a de facto deputy zoning inspector.
¶ 20 Our territorial supreme court in Jeffords v. Hine, 2 Ariz. 162, 168-69, 11 P. 351, 355 (1886), explained the rationale behind the de facto doctrine, which has arisen to ensure that the process of government continues even when an official must be removed for failure to meet certain statutory eligibility requirements:
Whatever may be said of the acts of a mere intruder, without any claim or color of title, it is well settled that a person actually obtaining an office, with the legal indicia of title, is a legal officer, until ousted, so far as his official acts are concerned, *184 they are as valid as if his title were not disputed. The public have an interest in the continuous and unbroken discharge of official duty, and the necessities thereof, and cannot wait to try the title of conflicting claimants to an office. For this reason it has come to be held, so often as to be now settled, that the official acts of the incumbent of an office, with whom alone the public can, under the circumstances, transact business, shall be regarded as legal. The affairs of society could not be carried on in any other way than by treating as valid the official acts of [a] person de facto in office.
¶ 21 Subsequent Arizona cases, affirming the principle enunciated in Jeffords, have established the following test for a de facto public official:
An officer de facto is one whose acts, though not those of a lawful officer, the law, upon principles of policy and justice, will hold valid so far as they involve the interests of the public and third persons, where the duties of the office were exercised... under color of a known election or appointment [which was] void because the officer was not eligible, or because there was a want of power in the electing or appointing body, or by reason of some defect or irregularity in its exercise, such ineligibility, want of power, or defect being unknown to the public.
Rogers v. Frohmiller, 59 Ariz. 513, 521, 130 P.2d 271, 274 (1942) (quoting State v. Carroll, 38 Conn. 449 (1871)); see also Jennings v. Woods, 194 Ariz. 314, 332, ¶ 87, 982 P.2d 274, 292 (1999) (reiterating the de facto test from Rogers).
¶ 22 In this case, we must presume that the interests of the public are served through the enforcement of the county's zoning regulations, the purpose of which is "to promote the general welfare by providing a more stable environment for the orderly development of communities." Weitz v. Davis, 102 Ariz. 40, 43, 424 P.2d 168, 171 (1967). And there is no suggestion by Appellants that, at the time Stansbury appointed Van Why as deputy zoning inspector, any person was aware that the appointment did not comply with the requirements of A.R.S. § 11-808(A).
¶ 23 On this record, therefore, we hold that Van Why was acting as a de facto deputy county zoning inspector for the County when he issued the complaints against Appellants and, thus, the complaints are not void for the failure of the Board to appoint Van Why under A.R.S. § 11-808(A) as a deputy inspector.[4]

CONCLUSION
¶ 24 For the foregoing reasons, we affirm that Stansbury's appointment as the county zoning inspector for the County had continuing validity despite the amendment of § 401.00 of the County's ordinances. We also determine that the language of A.R.S. § 11-808(A) requires deputy county zoning inspectors to be appointed by the County Board of Supervisors. We affirm the validity of Van Why's actions in this matter, however, because he acted in the capacity of a de facto deputy zoning inspector.
¶ 25 For these reasons, we affirm the trial court's order dismissing Appellants' complaint.
CONCURRING: PATRICIA K. NORRIS, Presiding Judge and DONN KESSLER, Judge.
NOTES
[1]  The title to § 401.00 now reads "Section 401.00  Manufactured Home Permits."
[2]  Both sides agree that the county zoning inspector must be appointed by the Board.
[3]  Although the last antecedent rule may aid in interpretation of statutes, its force is limited. In Town of South Tucson v. Bd. of Sup'rs of Pima County, 52 Ariz. 575, 584, 84 P.2d 581, 585 (1938), our supreme court said that the clear intent of the Legislature takes precedence over all grammatical rules of statutory construction, particularly the doctrine of the last antecedent. Similarly, we decline to give substantial weight to a grammatical argument made by the County that because the last two commas in § 11-808(A) encompass or enclose the reference to deputy inspectors, the enclosed language must be considered a parenthetical phrase. According to this argument, the parenthetical reference to deputy inspectors may be set aside, and the requirement of Board appointment is then understood to apply only to the county zoning inspector.
[4]  We do not address the validity of the actions of Deputy Zoning Inspector Van Why after the issuance of the mandate in this appeal. That issue was not briefed by the parties and is not before us.
