Section 18. If money is forfeited or recovered upon a recognizance or deposit in lieu thereof given in proceedings under sections fifteen to eighteen, inclusive, or any of them, the court in which such proceedings are pending may order such money paid to the probation officer and expended by him, under the direction of the court, for the support of the child.