
170 Ariz. 233 (1992)
823 P.2d 681
STATE of Arizona, Appellee,
v.
Brian Keith REYNOLDS, Appellant.
No. CR-91-0116-PR.
Supreme Court of Arizona, En Banc.
January 7, 1992.
Grant Woods, Atty. Gen., Paul J. McMurdie, Atty. General's Office, Chief Counsel, Crim. Appeals Section, Jack Roberts, Asst. Atty. Gen., Phoenix, for appellee.
Dean W. Trebesch, Maricopa County Public Defender, Stephen R. Collins, Deputy Maricopa County Public Defender, Phoenix, for appellant.

OPINION
GORDON, Chief Justice.
The State of Arizona petitioned for review of the court of appeals' opinion holding that a defendant is entitled to credit for time spent in a drug rehabilitation program as time spent "in custody" pursuant to A.R.S. § 13-709(B). We granted review to resolve a conflict between court of appeals' decisions on this issue. We have jurisdiction pursuant to Ariz. Const. art. 6, § 5(3), and A.R.S. § 12-120.24.
FACTUAL AND PROCEDURAL HISTORY
Brian Reynolds (appellant) pleaded guilty to attempted sale of narcotic drugs. The trial court placed him on five years probation. After violating probation, he was reinstated on intensive probation on condition that he participate in the New Arizona Family, a residential drug treatment program. Appellant violated probation again by failing to complete the program. After the second probation violation, the trial court gave him a mitigated prison term of 3.75 years, and denied appellant credit for *234 the 297 days he spent in the New Arizona Family program.
Appellant appealed, arguing that the trial court erred in denying him credit for presentence incarceration spent in the rehabilitation program because the restrictive nature of the program placed appellant "in custody" within the meaning of A.R.S. § 13-709(B).[1] The court of appeals agreed, and held "that when a defendant is confined in such a program under conditions which the trial court finds are as onerous and as restrictive on movement and conduct as those a defendant would experience if he were in jail, a defendant is entitled to credit for time if he is later sentenced to imprisonment." State v. Reynolds, 168 Ariz. 580, 580-81, 816 P.2d 237, 237-38 (App. 1991). The court of appeals acknowledged that there is Arizona case law directly at odds with its holding, specifically State v. Vasquez, 153 Ariz. 320, 736 P.2d 803 (App. 1987). Because we believe the court of appeals erred in giving appellant credit for time he spent in a rehabilitation program, we vacate the court of appeals' opinion and affirm the trial court's decision.
DISCUSSION
To resolve the issue in this case, we must determine what the legislature meant when it used the words "in custody" and how our courts have interpreted the "in custody" requirement of A.R.S. § 13-709(B) that provides:
All time actually spent in custody pursuant to an offense until the prisoner is sentenced to imprisonment for such an offense shall be credited against the term of imprisonment otherwise provided for by this chapter.
When interpreting the meaning of particular statutory provisions, we seek to discern the intent of the legislature. We look primarily to the language of the statute itself and give effect to the statutory terms in accordance with their commonly accepted meanings, see A.R.S. § 1-213, "unless the legislature has offered its own definition of the words or it appears from the context that a special meaning was intended." Mid Kansas Fed. Sav. and Loan v. Dynamic Dev. Corp., 167 Ariz. 122, 128, 804 P.2d 1310, 1316 (1991); State v. Korzep, 165 Ariz. 490, 493, 799 P.2d 831, 834 (1990). If a statute's language is clear and unambiguous, the court will give it effect without resorting to other rules of statutory construction. Janson v. Christensen, 167 Ariz. 470, 471, 808 P.2d 1222, 1223 (1991).
We note that the word "custody" is not defined explicitly within the criminal code and it does not appear that the legislature attached any special meaning or definition to the phrase "in custody." Because some ambiguity exists, the court may examine a variety of factors including the language used, the context, the subject matter, the effects and consequences, and the spirit and purpose of the law. Korzep, 165 Ariz. at 493, 799 P.2d at 834. The court of appeals recently construed this identical statutory provision in State v. Cereceres, 166 Ariz. 14, 800 P.2d 1 (App. 1990). We find its analysis both helpful and persuasive. It stated:
Use of the word "custody" is not uniform. It is commonly interchangeable with such terms as "imprisonment", "jail", "arrest", and "detention". Consequently, its meaning varies depending upon the construction of the particular statute under consideration....
[W]e note that A.R.S. § 13-709(B) is located in the chapter of the penal code relating to sentencing. Its stated purpose is to credit a defendant with all time served in presentence incarceration. The word "custody" thus appears in the context of serving a sentence of imprisonment.... Accordingly, we can reasonably infer that the legislature intended that custody, for purposes of A.R.S. *235 § 13-709(B), be equated with incarceration in a jail or prison and not merely with the substantial restraint of freedom which is commensurate with an arrest or detention.
166 Ariz. at 15, 800 P.2d at 2.
We conclude, as did the court of appeals in Cereceres, that the legislature intended the words "in custody" to mean actual incarceration in a prison or jail and more than simply a restraint on freedom as onerous as jail or prison would be. Cereceres did not break new ground in reaching this conclusion. Arizona court decisions have consistently interpreted the "in custody" requirement of this statute to mean actual or constructive control of prison or jail authorities.[2]See State v. Ritch, 160 Ariz. 495, 497, 774 P.2d 234, 236 (App. 1989) (holding that a defendant is entitled to credit only when in actual or constructive control of jail or prison officials and that a central conceptual difference exists between incarceration and structured rehabilitation and treatment); State v. Vasquez, 153 Ariz. 320, 321, 736 P.2d 803, 804 (App. 1987) (holding that a defendant is entitled to credit only for periods in which defendant is in actual or constructive control of jail or prison officials). We also believe that this interpretation is correct because it furthers the stated purpose in § 13-709(B) of crediting the defendant with all time served in presentence incarceration.
We also note, as did Judge McGregor in her dissent, that the legislature could specifically have provided for credit for time spent in drug rehabilitation centers but it has not done so. In other instances, when the legislature has intended that defendants receive credit for time spent in custody under different circumstances, the legislature has expressly outlined exactly what those circumstances are. See, e.g., § 13-605(D) (mandates credit for periods of commitment for diagnostic purposes); § 13-606(B) (mandates credit for periods of civil commitment); § 13-709(C) (mandates credit at resentencing for time served under a vacated sentence); § 13-903(F) (mandates credit pursuant to § 13-901(F) for time spent in jail during defendant's period of probation).
Jail time credit varies widely among the states, but there are four basic approaches. Because the issue is generally treated as purely statutory, jurisdictions reach many different conclusions. The first approach is taken by jurisdictions that have enacted statutes explicitly providing that a defendant receive credit on a prison sentence for time spent in custody or confinement as a result of the offense for which he is being sentenced. See, e.g., People v. Rodgers, 79 Cal. App.3d 26, 144 Cal. Rptr. 602 (1978) (defendant who resided in residential rehabilitation program as a condition of probation entitled to credit because defendant "in custody" within the meaning of Cal. Penal Code, § 2900.5).
Second, other states treat a defendant ordered to a restrictive environment as a condition of probation the same as a defendant detained in jail, and thus give him credit, even though their jail credit statutes do not explicitly require it. See, e.g., People v. Stange, 91 Mich. App. 596, 283 N.W.2d 806 (1979) (crediting statute is remedial and deserves liberal construction; defendant's time in rehabilitation center analogous to jail); Commonwealth v. Cozzone, 593 A.2d 860 (Pa. 1991) (appellant entitled to credit for time spent in alcohol treatment facility as "time spent in custody" within the contemplation of the Pennsylvania statute).
The third category of jurisdictions deny credit to a defendant placed on probation and placed in a restrictive environment because he is not "in custody" within the meaning of their statutes. See, e.g., Grant v. State, 99 Nev. 149, 659 P.2d 878 (1983) (no credit to appellant for time spent in residential drug treatment programs); State v. Babcock, 226 Kan. 356, 597 P.2d 1117 (1979) (defendant in halfway house not under control, actual or constructive, of *236 jail officials; therefore defendant not in custody as contemplated by statute governing jail time credit); People v. Radar, 652 P.2d 1085 (Colo. App. 1982) (defendant not entitled to credit for time spent in community corrections halfway house following revocation of his probation; residency in such a facility does not involve confinement as contemplated by applicable statute); Staggs v. State, 706 S.W.2d 822 (Tex. App. 1986) (appellant not entitled to credit for time spent in Court Residential Center; term "imprisonment" in statute does not mean or include such residency).
The fourth approach to jail credit is taken by those states with statutes explicitly denying credit for time spent in a rehabilitation program. See, e.g., Burton v. State, 547 N.E.2d 882 (Ind. App. 1989) (appellant not entitled to time spent confined to DuComb Center program as condition to probation; Indiana statute explicitly states a person does not earn credit time while on probation); State v. Peterson, 359 N.W.2d 708 (Minn.App. 1984) (comment to Minnesota jail credit statute states that credit should not be extended for time spent in residential treatment facilities as a condition of a stay of imposition or a stay of execution).
Appellant and the court of appeals would like to place Arizona into the second category of jurisdictions. To support his position that credit should be given for time spent in rehabilitation, appellant cites Lock v. State, 609 P.2d 539 (Alaska 1980). The Alaska statute is similar to A.R.S. § 13-709(B). It states, in part, that "[a] person who is sentenced shall receive credit toward service of his sentence for time spent in custody pending trial or sentencing, or appeal, if that detention was in connection with the offense for which sentence was imposed." AS 11.05.040(a). Lock held that a defendant who, as a condition of probation, had spent time in a rehabilitation program that imposed substantial restrictions on his freedom of movement and behavior had spent such time in custody within the meaning of the statute.
Although we agree that our statutes have similar language, we decline to follow the Alaska court because we also believe that our statute must be read harmoniously with the other credit statutes adopted by our legislature. For example, A.R.S. § 13-903(F) states that "[t]ime spent in custody under § 13-901, subsection F shall be credited to any sentence of imprisonment imposed upon revocation of probation." (Emphasis added.) Section 901(F) specifically refers to time that the defendant is imprisoned in the county jail. We believe a harmonious interpretation of these statutes requires credit only for periods in which defendant is in the actual or constructive control of jail or prison officials. Our court of appeals reached the same conclusion in Vasquez, 153 Ariz. at 321, 736 P.2d at 804.
We believe that setting a bright line rule that no credit be given for time spent in a rehabilitation center will further the intent of the legislature. The court of appeals states that it is unlikely that our state legislature has foreseen every circumstance that should properly give rise to presentence incarceration credit. We accept that a legislature might find it difficult to incorporate every possible circumstance into a statute; however, it is not difficult to incorporate credit for rehabilitation time into a statute's language.[3]
We agree that oftentimes the conditions of a restrictive rehabilitation center may be equal to or more severe than incarceration. Each rehabilitation program or center will have varying degrees of restrictiveness and severity, perhaps even among participants who have achieved varying levels of success within the program. Because our statute states that credit is to be given for time spent in custody pursuant to the offense, we believe that the legislature must state otherwise before alternative programs will be deemed "in custody". The difficulties a trial court would encounter in determining in advance, or at least after *237 the violation of probation, whether each type of rehabilitation program equaled or exceeded the amount of restraint on the defendant's liberty on a case-by-case basis would result in inconsistent and potentially unfair credit being granted.
We also believe that a potentially serious consequence of allowing credit for probation time spent in rehabilitation is that a probationer would be less encouraged to fulfill the requirements of his probation. As the court of appeals stated in Vasquez, "We believe that denying credit for time spent in a treatment program ... encourages probationers to participate fully in such programs and to adhere to their conditions of probation." 153 Ariz. at 322, 736 P.2d at 805.
DISPOSITION
We hold that time served in a rehabilitation program is not time served "in custody" for purposes of A.R.S. § 13-709(B). We vacate the court of appeals' opinion and affirm the trial court's decision.
FELDMAN, V.C.J., and CAMERON, MOELLER and CORCORAN, JJ., concur.
NOTES
[1]  Because we find that time served in a rehabilitation program, regardless of the severity of the program's restrictiveness, is not time served "in custody" for purposes of A.R.S. § 13-709(B), we need not go into detail as to the specific restrictions applied to appellant at the New Arizona Family. Such a description may be found in State v. Reynolds, 168 Ariz. 580, 581, 816 P.2d 237, 238 (App. 1991).
[2]  This construction is also in accord with the dictionary definition of custody: "judicial or penal safekeeping: control of a ... person with such actual or constructive possession as fulfills the purpose of the law or duty requiring it: imprisonment or durance of persons...." Webster's Third New International Dictionary 559 (3rd ed. 1976).
[3]  A good example of such language may be found in California Penal Code 2900.5, which provides for credit for time spent "in custody, including but not limited to any time spent in a jail, camp, work furlough facility, half-way house, rehabilitation facility, hospital, prison, juvenile detention facility, or similar residential institution...."
