This is the best explanation with the code in PHP I've found so far:
http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428
In short:
Although the syntax for scheduling a new task may seem complicated at first, it is actually relatively easy to understand once you add it. The cron task will always contain five columns, each of which is a chronological “statement”, followed by the full path and command to execute:
* * * * * home / path / to / command / the_command.sh
Each of the chronological columns has a special relation to the task schedule. They look like this:
Minutes represents the minutes of a given hour, 0-59 respectively. Hours represents the hours of a given day, 0-23 respectively. Days represents the days of a given month, 1-31 respectively. Months represents the months of a given year, 1-12 respectively. Day of the Week represents the day of the week, Sunday through Saturday, numerically, as 0-6 respectively.

So, for example, if you planned a task at 12am on the first day of each month, it would look something like this:
0 0 1 * * home / path / to / command / the_command.sh
If we planned to launch the task every Saturday at 8:30, we would write it as follows:
30 8 * * 6 home / path / to / command / the_command.sh
There are also a number of operators that can be used to further configure the schedule:
Commas is used to create a comma separated list of values for any of the cron columns. Dashes is used to specify a range of values. Asterisksis used to specify 'all' or 'every' value
Follow the link for the full article, it explains:
- What is the cronjob format if you want to enter / edit it manually.
- How to use PHP with SSH2 library for authentication as the user you want to edit crontab.
- A complete PHP class with all the necessary authentication methods, editing and deleting crontab entries.