diff --git a/admin/xmldb/actions/edit_table/edit_table.class.php b/admin/xmldb/actions/edit_table/edit_table.class.php
index 70b87d9..cc15ad8 100644
--- a/admin/xmldb/actions/edit_table/edit_table.class.php
+++ b/admin/xmldb/actions/edit_table/edit_table.class.php
@@ -141,7 +141,7 @@ class edit_table extends XMLDBAction {
         $e = '';
         $cansavenow = false;
         if ($structure->hasChanged()) {
-            if (!is_writeable($dirpath . '/install.xml') || !is_writeable($dirpath)) {
+            if (!is_writable($dirpath . '/install.xml') || !is_writable($dirpath)) {
                 $e .= '<p class="centerpara error">' . $this->str['pendingchangescannotbesaved'] . '</p>';
             } else {
                 $e .= '<p class="centerpara warning">' . $this->str['pendingchanges'] . '</p>';
diff --git a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
index f7394d9..c92b792 100644
--- a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
+++ b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
@@ -128,7 +128,7 @@ class edit_xml_file extends XMLDBAction {
                 $e = '';
                 $cansavenow = false;
                 if ($structure->hasChanged()) {
-                    if (!is_writeable($dirpath . '/install.xml') || !is_writeable($dirpath)) {
+                    if (!is_writable($dirpath . '/install.xml') || !is_writable($dirpath)) {
                         $e .= '<p class="centerpara error">' . $this->str['pendingchangescannotbesaved'] . '</p>';
                     } else {
                         $e .= '<p class="centerpara warning">' . $this->str['pendingchanges'] . '</p>';
diff --git a/admin/xmldb/actions/main_view/main_view.class.php b/admin/xmldb/actions/main_view/main_view.class.php
index 2dbe64d..ce0004c 100644
--- a/admin/xmldb/actions/main_view/main_view.class.php
+++ b/admin/xmldb/actions/main_view/main_view.class.php
@@ -153,7 +153,7 @@ class main_view extends XMLDBAction {
             /// The create button
                 if ($dbdir->path_exists &&
                     !file_exists($key . '/install.xml') &&
-                    is_writeable($key)) {
+                    is_writable($key)) {
                     $b .= '<a href="index.php?action=create_xml_file&amp;sesskey=' . sesskey() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&amp;time=' . time() . '&amp;postaction=main_view#lastused">[' . $this->str['create'] . ']</a>';
                 } else {
                     $b .= '[' . $this->str['create'] . ']';
@@ -183,8 +183,8 @@ class main_view extends XMLDBAction {
             /// The save button
                 if ($dbdir->path_exists &&
                     file_exists($key . '/install.xml') &&
-                    is_writeable($key . '/install.xml') &&
-                    is_writeable($key) &&
+                    is_writable($key . '/install.xml') &&
+                    is_writable($key) &&
                     !empty($dbdir->xml_loaded) &&
                     !empty($dbdir->xml_changed)) {
                     $b .= '<a href="index.php?action=save_xml_file&amp;sesskey=' . sesskey() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&amp;time=' . time() . '&amp;postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
@@ -222,7 +222,7 @@ class main_view extends XMLDBAction {
                 if ($dbdir->path_exists &&
                     file_exists($key . '/install.xml') &&
                     is_readable($key . '/install.xml') &&
-                    is_writeable($key) &&
+                    is_writable($key) &&
                     !empty($dbdir->xml_loaded) &&
                     !empty($dbdir->xml_changed)) {
                     $b .= '<a href="index.php?action=revert_changes&amp;sesskey=' . sesskey() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['revert'] . ']</a>';
@@ -245,7 +245,7 @@ class main_view extends XMLDBAction {
                 if ($dbdir->path_exists &&
                     file_exists($key . '/install.xml') &&
                     is_readable($key . '/install.xml') &&
-                    is_writeable($key) &&
+                    is_writable($key) &&
                     empty($dbdir->xml_loaded)) {
                     $b .= '<a href="index.php?action=delete_xml_file&amp;sesskey=' . sesskey() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['delete'] . ']</a>';
                 } else {
@@ -310,7 +310,7 @@ class main_view extends XMLDBAction {
                     file_exists($key . '/install.xml') &&
                     !empty($dbdir->xml_loaded) &&
                     !empty($dbdir->xml_changed) &&
-                    (!is_writeable($key . '/install.xml') || !is_writeable($key))) {
+                    (!is_writable($key . '/install.xml') || !is_writeable($key))) {
 
                     if ($hithis) {
                         $o .= '<tr class="highlight"><td class="error cell" colspan="10">';
diff --git a/admin/xmldb/actions/save_xml_file/save_xml_file.class.php b/admin/xmldb/actions/save_xml_file/save_xml_file.class.php
index 0e7523c..5024af5 100644
--- a/admin/xmldb/actions/save_xml_file/save_xml_file.class.php
+++ b/admin/xmldb/actions/save_xml_file/save_xml_file.class.php
@@ -87,7 +87,7 @@ class save_xml_file extends XMLDBAction {
         }
 
     /// Chech for perms
-        if (!is_writeable($dirpath . '/install.xml')) {
+        if (!is_writable($dirpath . '/install.xml')) {
             $this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
             return false;
         }
diff --git a/auth/cas/CAS/CAS.php b/auth/cas/CAS/CAS.php
index e6bae3f..5bcb7e7 100644
--- a/auth/cas/CAS/CAS.php
+++ b/auth/cas/CAS/CAS.php
@@ -523,7 +523,7 @@ class phpCAS {
 		$file = '?';
 		$line = '?';
 		if (is_array($dbg)) {
-			for ($i = 1; $i < sizeof($dbg); $i++) {
+			for ($i = 1; $i < count($dbg); $i++) {
 				if (is_array($dbg[$i])) {
 					if ($dbg[$i]['class'] == __CLASS__) {
 						$function = $dbg[$i]['function'];
diff --git a/auth/cas/CAS/CAS/PGTStorage/pgt-file.php b/auth/cas/CAS/CAS/PGTStorage/pgt-file.php
index e4190a8..6f04384 100644
--- a/auth/cas/CAS/CAS/PGTStorage/pgt-file.php
+++ b/auth/cas/CAS/CAS/PGTStorage/pgt-file.php
@@ -228,7 +228,7 @@ class PGTStorageFile extends PGTStorage
 	  $fname = $this->getPGTIouFilename($pgt_iou);
 	  if(!file_exists($fname)){
 		  if ( $f=fopen($fname,"w") ) {
-			  if ( fputs($f,$pgt) === FALSE ) {
+			  if ( fwrite($f,$pgt) === FALSE ) {
 				  phpCAS::error('could not write PGT to `'.$fname.'\'');
 			  }
 			  fclose($f);
diff --git a/auth/cas/CAS/CAS/client.php b/auth/cas/CAS/CAS/client.php
index 74d6893..df6c8c6 100644
--- a/auth/cas/CAS/CAS/client.php
+++ b/auth/cas/CAS/CAS/client.php
@@ -1450,9 +1450,9 @@ class CASClient
 						TRUE/*$bad_response*/,
 						$text_response);
 				}
-				if ( sizeof($success_elements = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) {
+				if ( count($success_elements = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) {
 					// authentication succeded, extract the user name
-					if ( sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) {
+					if ( count($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) {
 						phpCAS::trace('<authenticationSuccess> found, but no <user>');
 						$this->authError('ST not validated',
 							$validate_url,
@@ -1464,7 +1464,7 @@ class CASClient
 					phpCAS::trace('user = `'.$user);
 					$this->setUser($user);
 					
-				} else if ( sizeof($failure_elements = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) {
+				} else if ( count($failure_elements = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) {
 					phpCAS::trace('<authenticationFailure> found');
 					// authentication failed, extract the error code and message
 					$this->authError('ST not validated',
@@ -1558,7 +1558,7 @@ class CASClient
 						$text_response);
 				}
 				// check for the NameIdentifier tag in the SAML response
-				if ( sizeof($success_elements = $tree_response->get_elements_by_tagname("NameIdentifier")) != 0) {
+				if ( count($success_elements = $tree_response->get_elements_by_tagname("NameIdentifier")) != 0) {
 					phpCAS::trace('NameIdentifier found');
 					$user = trim($success_elements[0]->get_content());
 					phpCAS::trace('user = `'.$user.'`');
@@ -1971,7 +1971,7 @@ class CASClient
 		{
 		// here cannot use phpCAS::traceBegin(); alongside domxml-php4-to-php5.php
 		phpCAS::log('start validatePGT()');
-		if ( sizeof($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) {
+		if ( count($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) {
 			phpCAS::trace('<proxyGrantingTicket> not found');
 			// authentication succeded, but no PGT Iou was transmitted
 			$this->authError('Ticket validated but no PGT Iou transmitted',
@@ -2077,9 +2077,9 @@ class CASClient
 		
 		if ( !$bad_response ) {
 			// look for a proxySuccess tag
-			if ( sizeof($arr = $root->get_elements_by_tagname("proxySuccess")) != 0) {
+			if ( count($arr = $root->get_elements_by_tagname("proxySuccess")) != 0) {
 				// authentication succeded, look for a proxyTicket tag
-				if ( sizeof($arr = $root->get_elements_by_tagname("proxyTicket")) != 0) {
+				if ( count($arr = $root->get_elements_by_tagname("proxyTicket")) != 0) {
 					$err_code = PHPCAS_SERVICE_OK;
 					$err_msg = '';
 					phpCAS::trace('original PT: '.trim($arr[0]->get_content()));
@@ -2091,7 +2091,7 @@ class CASClient
 				}
 			} 
 			// look for a proxyFailure tag
-			else if ( sizeof($arr = $root->get_elements_by_tagname("proxyFailure")) != 0) {
+			else if ( count($arr = $root->get_elements_by_tagname("proxyFailure")) != 0) {
 				// authentication failed, extract the error
 				$err_code = PHPCAS_SERVICE_PT_FAILURE;
 				$err_msg = 'PT retrieving failed (code=`'
@@ -2567,9 +2567,9 @@ class CASClient
 				TRUE/*$bad_response*/,
 				$text_response);
 		}
-		if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) {
+		if ( count($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) {
 			// authentication succeded, extract the user name
-			if ( sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) {
+			if ( count($arr = $tree_response->get_elements_by_tagname("user")) == 0) {
 				// no user specified => error
 				$this->authError('PT not validated',
 					$validate_url,
@@ -2579,7 +2579,7 @@ class CASClient
 			}
 			$this->setUser(trim($arr[0]->get_content()));
 			
-		} else if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) {
+		} else if ( count($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) {
 			// authentication succeded, extract the error code and message
 			$this->authError('PT not validated',
 				$validate_url,
diff --git a/auth/fc/fcFPP.php b/auth/fc/fcFPP.php
index c082202..a61d1b8 100644
--- a/auth/fc/fcFPP.php
+++ b/auth/fc/fcFPP.php
@@ -94,14 +94,14 @@ class fcFPP
         if ($this->_conn)
     {
         # Send username
-        fputs($this->_conn,"$userid\r\n");
+        fwrite($this->_conn,"$userid\r\n");
 
         $line = fgets ($this->_conn);        //new line
         $line = fgets ($this->_conn);        //+0
         $line = fgets ($this->_conn);        //new line
 
         # Send password
-        fputs($this->_conn,"$passwd\r\n");
+        fwrite($this->_conn,"$passwd\r\n");
         $line = fgets ($this->_conn);        //new line
         $line = fgets ($this->_conn);        //+0
         $line = fgets ($this->_conn);        //+0 or message
@@ -132,7 +132,7 @@ class fcFPP
     // we must be logged in as a user with subadmin privileges
     if ($this->_conn AND $this->_user) {
         # Send BA-command to get groups
-        fputs($this->_conn,"GET USER '" . $userid . "' 4 -1\r");
+        fwrite($this->_conn,"GET USER '" . $userid . "' 4 -1\r");
         $line = "";
         while (!$line) {
         $line = trim(fgets ($this->_conn));
@@ -169,7 +169,7 @@ class fcFPP
 
     if ($this->_conn AND $this->_user) {
         # Send BA-command to get data
-        fputs($this->_conn,"GET USER '" . $userid . "' " . $field . "\r");
+        fwrite($this->_conn,"GET USER '" . $userid . "' " . $field . "\r");
         $line = "";
         while (!$line) {
             $line = trim(fgets ($this->_conn));
@@ -194,7 +194,7 @@ class fcFPP
 
     if ($this->_conn AND $this->_user) {
         # Send BA-command to get data
-        fputs($this->_conn,"GET RESUME '" . $userid . "' 6\r");
+        fwrite($this->_conn,"GET RESUME '" . $userid . "' 6\r");
         $line = "";
         while (!$line) {
                $line = trim(fgets ($this->_conn));
diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php
index d9cd436..43de0b7 100644
--- a/auth/ldap/auth.php
+++ b/auth/ldap/auth.php
@@ -1081,7 +1081,7 @@ class auth_plugin_ldap extends auth_plugin_base {
         if ($user_info_result) {
             $user_entry = ldap_get_entries_moodle($ldapconnection, $user_info_result);
             if (empty($user_entry)) {
-                $attribs = join (', ', $search_attribs);
+                $attribs = implode (', ', $search_attribs);
                 error_log($this->errorlogtag.get_string('updateusernotfound', 'auth_ldap',
                                                           array('userdn'=>$user_dn,
                                                                 'attribs'=>$attribs)));
diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php
index 4008d38..98b49cb 100644
--- a/auth/mnet/auth.php
+++ b/auth/mnet/auth.php
@@ -369,7 +369,7 @@ class auth_plugin_mnet extends auth_plugin_base {
                                cc.name AS cat_name, cc.description AS cat_description
                           FROM {course} c
                           JOIN {course_categories} cc ON c.category = cc.id
-                         WHERE c.id IN (" . join(',',array_keys($courses)) . ')';
+                         WHERE c.id IN (" . implode(',',array_keys($courses)) . ')';
                 $extra = $DB->get_records_sql($sql);
 
                 $keys = array_keys($courses);
@@ -742,7 +742,7 @@ class auth_plugin_mnet extends auth_plugin_base {
                 }
             } else {
                 debugging("Server side error has occured on host $mnethostid: " .
-                          join("\n", $mnet_request->error));
+                          implode("\n", $mnet_request->error));
                 break;
             }
             $mnethostlogssql = "
@@ -821,7 +821,7 @@ class auth_plugin_mnet extends auth_plugin_base {
                     debugging($mnet_request->response['message']);
                 }
             } else {
-                debugging("Server side error has occured on host $mnet_peer->ip: " .join("\n", $mnet_request->error));
+                debugging("Server side error has occured on host $mnet_peer->ip: " .implode("\n", $mnet_request->error));
             }
         }
     }
@@ -1006,7 +1006,7 @@ class auth_plugin_mnet extends auth_plugin_base {
             $mnet_request->add_param($username);
             $mnet_request->add_param($useragent);
             if ($mnet_request->send($mnet_peer) === false) {
-                debugging(join("\n", $mnet_request->error));
+                debugging(implode("\n", $mnet_request->error));
                 return false;
             }
         }
@@ -1060,7 +1060,7 @@ class auth_plugin_mnet extends auth_plugin_base {
             $mnet_request->add_param($useragent);
             if ($mnet_request->send($mnet_peer) === false) {
                 debugging("Server side error has occured on host $mnetsession->mnethostid: " .
-                          join("\n", $mnet_request->error));
+                          implode("\n", $mnet_request->error));
             }
         }
 
diff --git a/backup/restorelib.php b/backup/restorelib.php
index 654a87f..e4bc2bb 100644
--- a/backup/restorelib.php
+++ b/backup/restorelib.php
@@ -377,7 +377,7 @@
                                                 $tagsarr = $info['BLOG']['#']['BLOG_TAGS']['0']['#']['BLOG_TAG'];
                                                 //Iterate over tags
                                                 $tags = array();
-                                                $sizetagsarr = sizeof($tagsarr);
+                                                $sizetagsarr = count($tagsarr);
                                                 for ($i = 0; $i < $sizetagsarr; $i++) {
                                                     $tag_info = $tagsarr[$i];
                                                     ///traverse_xmlize($tag_info);                        //Debug
diff --git a/backup/util/ui/backup_ui.class.php b/backup/util/ui/backup_ui.class.php
index 70c7166..46491ca 100644
--- a/backup/util/ui/backup_ui.class.php
+++ b/backup/util/ui/backup_ui.class.php
@@ -162,7 +162,7 @@ class backup_ui extends base_ui {
             } else if ($stage < $currentstage) {
                 $classes[] = 'backup_stage_complete';
             }
-            $item = array('text' => strlen(decbin($stage)).'. '.get_string('currentstage'.$stage, 'backup'),'class' => join(' ', $classes));
+            $item = array('text' => strlen(decbin($stage)).'. '.get_string('currentstage'.$stage, 'backup'),'class' => implode(' ', $classes));
             if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && (!self::$skipcurrentstage || ($stage*2) != $currentstage)) {
                 $params = $this->stage->get_params();
                 if (empty($params)) {
diff --git a/backup/util/ui/import_extensions.php b/backup/util/ui/import_extensions.php
index b4f9068..3787439 100644
--- a/backup/util/ui/import_extensions.php
+++ b/backup/util/ui/import_extensions.php
@@ -49,7 +49,7 @@ class import_ui extends backup_ui {
             } else if ($stage < $currentstage) {
                 $classes[] = 'backup_stage_complete';
             }
-            $item = array('text' => strlen(decbin($stage*2)).'. '.get_string('importcurrentstage'.$stage, 'backup'),'class' => join(' ', $classes));
+            $item = array('text' => strlen(decbin($stage*2)).'. '.get_string('importcurrentstage'.$stage, 'backup'),'class' => implode(' ', $classes));
             if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && (!self::$skipcurrentstage || $stage*2 != $currentstage)) {
                 $item['link'] = new moodle_url($PAGE->url, $this->stage->get_params() + array('backup'=>$this->get_backupid(), 'stage'=>$stage));
             }
@@ -60,7 +60,7 @@ class import_ui extends backup_ui {
         $selectorlink->remove_params('importid');
         array_unshift($items, array(
                 'text' => '1. '.get_string('importcurrentstage0', 'backup'),
-                'class' => join(' ', $classes),
+                'class' => implode(' ', $classes),
                 'link' => $selectorlink));
         return $items;
     }
diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php
index e07bc0b..4968ca0 100644
--- a/backup/util/ui/renderer.php
+++ b/backup/util/ui/renderer.php
@@ -53,7 +53,7 @@ class core_backup_renderer extends plugin_renderer_base {
                 $item = html_writer::tag('span', $text, $item);
             }
         }
-        return html_writer::tag('div', join(get_separator(), $items), array('class'=>'backup_progress clearfix'));
+        return html_writer::tag('div', implode(get_separator(), $items), array('class'=>'backup_progress clearfix'));
     }
     /**
      * Prints a dependency notification
diff --git a/backup/util/ui/restore_ui.class.php b/backup/util/ui/restore_ui.class.php
index a4f7261..f7c94db 100644
--- a/backup/util/ui/restore_ui.class.php
+++ b/backup/util/ui/restore_ui.class.php
@@ -220,7 +220,7 @@ class restore_ui extends base_ui {
             } else if ($stage < $currentstage) {
                 $classes[] = 'backup_stage_complete';
             }
-            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'),'class' => join(' ', $classes));
+            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'),'class' => implode(' ', $classes));
             if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && $stage > self::STAGE_DESTINATION) {
                 $item['link'] = new moodle_url($PAGE->url, array('restore'=>$this->get_restoreid(), 'stage'=>$stage));
             }
diff --git a/backup/util/ui/restore_ui_stage.class.php b/backup/util/ui/restore_ui_stage.class.php
index 42b591d..704a35e 100644
--- a/backup/util/ui/restore_ui_stage.class.php
+++ b/backup/util/ui/restore_ui_stage.class.php
@@ -116,7 +116,7 @@ abstract class restore_ui_independent_stage {
             } else if ($stage < $currentstage) {
                 $classes[] = 'backup_stage_complete';
             }
-            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'),'class' => join(' ', $classes));
+            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'),'class' => implode(' ', $classes));
             if ($stage < $currentstage && $currentstage < restore_ui::STAGE_COMPLETE) {
                 //$item['link'] = new moodle_url($PAGE->url, array('restore'=>$this->get_restoreid(), 'stage'=>$stage));
             }
diff --git a/blocks/navigation/renderer.php b/blocks/navigation/renderer.php
index d59f87c..2d02030 100644
--- a/blocks/navigation/renderer.php
+++ b/blocks/navigation/renderer.php
@@ -76,7 +76,7 @@ class block_navigation_renderer extends plugin_renderer_base {
             if ($item->isactive === true) {
                 $liclasses[] = 'current_branch';
             }
-            $liattr = array('class'=>join(' ',$liclasses));
+            $liattr = array('class'=>implode(' ',$liclasses));
             // class attribute on the div item which only contains the item content
             $divclasses = array('tree_item');
             if ($isbranch) {
@@ -88,9 +88,9 @@ class block_navigation_renderer extends plugin_renderer_base {
                 $divclasses[] = 'hasicon';
             }
             if (!empty($item->classes) && count($item->classes)>0) {
-                $divclasses[] = join(' ', $item->classes);
+                $divclasses[] = implode(' ', $item->classes);
             }
-            $divattr = array('class'=>join(' ', $divclasses));
+            $divattr = array('class'=>implode(' ', $divclasses));
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
diff --git a/blocks/settings/renderer.php b/blocks/settings/renderer.php
index 41cea87..da8009a 100644
--- a/blocks/settings/renderer.php
+++ b/blocks/settings/renderer.php
@@ -51,7 +51,7 @@ class block_settings_renderer extends plugin_renderer_base {
             if ($item->isactive === true) {
                 $liclasses[] = 'current_branch';
             }
-            $liattr = array('class'=>join(' ',$liclasses));
+            $liattr = array('class'=>implode(' ',$liclasses));
             // class attribute on the div item which only contains the item content
             $divclasses = array('tree_item');
             if ($isbranch) {
@@ -60,9 +60,9 @@ class block_settings_renderer extends plugin_renderer_base {
                 $divclasses[] = 'leaf';
             }
             if (!empty($item->classes) && count($item->classes)>0) {
-                $divclasses[] = join(' ', $item->classes);
+                $divclasses[] = implode(' ', $item->classes);
             }
-            $divattr = array('class'=>join(' ', $divclasses));
+            $divattr = array('class'=>implode(' ', $divclasses));
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
diff --git a/calendar/renderer.php b/calendar/renderer.php
index 1c906d6..7adc959 100644
--- a/calendar/renderer.php
+++ b/calendar/renderer.php
@@ -486,7 +486,7 @@ class core_calendar_renderer extends plugin_renderer_base {
             } else {
                 $cellclasses[] = 'nottoday';
             }
-            $cell->attributes = array('class'=>join(' ',$cellclasses));
+            $cell->attributes = array('class'=>implode(' ',$cellclasses));
 
             if (isset($eventsbyday[$calendar->day])) {
                 $cell->text .= html_writer::start_tag('ul', array('class'=>'events-new'));
diff --git a/course/lib.php b/course/lib.php
index 889dd45..82c102c 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -1503,7 +1503,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
             if ($extraclasses) {
                 $liclasses = array_merge($liclasses, explode(' ', $extraclasses));
             }
-            echo html_writer::start_tag('li', array('class'=>join(' ', $liclasses), 'id'=>'module-'.$modnumber));
+            echo html_writer::start_tag('li', array('class'=>implode(' ', $liclasses), 'id'=>'module-'.$modnumber));
             if ($ismoving) {
                 echo '<a title="'.$strmovefull.'"'.
                      ' href="'.$CFG->wwwroot.'/course/mod.php?moveto='.$mod->id.'&amp;sesskey='.sesskey().'">'.
@@ -1519,7 +1519,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
                     $classes[] = 'mod-indent-huge';
                 }
             }
-            echo html_writer::start_tag('div', array('class'=>join(' ', $classes)));
+            echo html_writer::start_tag('div', array('class'=>implode(' ', $classes)));
 
             // Get data about this course-module
             list($content, $instancename) =
diff --git a/course/renderer.php b/course/renderer.php
index 07b7bc5..608717f 100644
--- a/course/renderer.php
+++ b/course/renderer.php
@@ -107,7 +107,7 @@ class core_course_renderer extends plugin_renderer_base {
                 $classes[] = 'collapsed';
             }
         }
-        $content .= html_writer::start_tag('div', array('class'=>join(' ', $classes)));
+        $content .= html_writer::start_tag('div', array('class'=>implode(' ', $classes)));
         $content .= html_writer::start_tag('div', array('class'=>'category_label'));
         $content .= html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $category->name, array('class'=>'category_link'));
         $content .= html_writer::end_tag('div');
@@ -129,7 +129,7 @@ class core_course_renderer extends plugin_renderer_base {
                 }
                 $coursecount ++;
                 $classes[] = ($coursecount%2)?'odd':'even';
-                $content .= html_writer::start_tag('div', array('class'=>join(' ', $classes)));
+                $content .= html_writer::start_tag('div', array('class'=>implode(' ', $classes)));
                 $content .= html_writer::link(new moodle_url('/course/view.php', array('id'=>$course->id)), format_string($course->fullname), array('class'=>$linkclass));
                 $content .= html_writer::start_tag('div', array('class'=>'course_info clearfix'));
 
diff --git a/enrol/paypal/ipn.php b/enrol/paypal/ipn.php
index 3d1b608..5e44daf 100644
--- a/enrol/paypal/ipn.php
+++ b/enrol/paypal/ipn.php
@@ -104,7 +104,7 @@ if (!$fp) {  /// Could not open a socket to PayPal - FAIL
 
 /// Connection is OK, so now we post the data to validate it
 
-fputs ($fp, $header.$req);
+fwrite ($fp, $header.$req);
 
 /// Now read the response and check if everything is OK.
 
diff --git a/enrol/renderer.php b/enrol/renderer.php
index d7a9cb4..38cb6ca 100644
--- a/enrol/renderer.php
+++ b/enrol/renderer.php
@@ -416,7 +416,7 @@ class course_enrolment_table extends html_table implements renderable {
 
                     }
                 }
-                $newlabel = join(' / ', $bits);
+                $newlabel = implode(' / ', $bits);
             } else {
                 if (!in_array($name, self::$sortablefields)) {
                     $newlabel = $label;
@@ -471,7 +471,7 @@ class course_enrolment_table extends html_table implements renderable {
                     if (empty($bits)) {
                         $bits[] = '&nbsp;';
                     }
-                    $row->cells[] = new html_table_cell(join(' ', $bits));
+                    $row->cells[] = new html_table_cell(implode(' ', $bits));
                 } else {
                     if (!array_key_exists($field, $user)) {
                         $user[$field] = '&nbsp;';
diff --git a/filter/tex/latex.php b/filter/tex/latex.php
index 47c7c3b..aa5df78 100644
--- a/filter/tex/latex.php
+++ b/filter/tex/latex.php
@@ -104,7 +104,7 @@
 
             // turn the latex doc into a .tex file in the temp area
             $fh = fopen( $tex, 'w' );
-            fputs( $fh, $doc );
+            fwrite( $fh, $doc );
             fclose( $fh );
 
             // run latex on document
diff --git a/filter/tex/texdebug.php b/filter/tex/texdebug.php
index 35f1afb..b5d95f4 100644
--- a/filter/tex/texdebug.php
+++ b/filter/tex/texdebug.php
@@ -237,7 +237,7 @@
         $output .= "<p>Processing TeX expression:</p><pre>$expression</pre>\n";
         $doc = $latex->construct_latex_document($expression);
         $fh = fopen($tex, 'w');
-        fputs($fh, $doc);
+      	fwrite($fh, $doc);
         fclose($fh);
 
         // cd to temp dir
diff --git a/grade/simpletest/testedittree.php b/grade/simpletest/testedittree.php
index 7f1b8ca..4572ca6 100644
--- a/grade/simpletest/testedittree.php
+++ b/grade/simpletest/testedittree.php
@@ -46,7 +46,7 @@ class gradeedittreelib_test extends UnitTestCase {
         $numinput = array( 0,   1,   1.01, '1.010', 1.2345);
         $numoutput = array(0.0, 1.0, 1.01,  1.01,   1.2345);
 
-        for ($i=0; $i<sizeof($numinput); $i++) {
+        for ($i=0; $i<count($numinput); $i++) {
             $msg = 'format_number() testing '.$numinput[$i].' %s';
             $this->assertEqual(grade_edit_tree::format_number($numinput[$i]),$numoutput[$i],$msg);
         }
diff --git a/lib/base32.php b/lib/base32.php
index 831c712..d3075b5 100644
--- a/lib/base32.php
+++ b/lib/base32.php
@@ -190,7 +190,7 @@ function Base32_decode($inString) {
         $deArr[$i] = chr(bindec(substr($deCompBits, $i*8, 8)));
     }
     
-    $outString = join('',$deArr);
+    $outString = implode('',$deArr);
     
     return $outString;
 }
diff --git a/lib/datalib.php b/lib/datalib.php
index 79a69e4..3dc7cc4 100644
--- a/lib/datalib.php
+++ b/lib/datalib.php
@@ -545,7 +545,7 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
     } elseif (is_array($fields)) {
         $fields = array_merge($basefields,$fields);
     }
-    $coursefields = 'c.' .join(',c.', $fields);
+    $coursefields = 'c.' .implode(',c.', $fields);
 
     if (empty($sort)) {
         $sortstatement = "";
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index abdb815..a40e0cf 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -2097,7 +2097,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         // Blocks that are outmoded and for whom the bells will toll... by which I
         // mean we will delete all instances of
         $outmodedblocks = array('participants','admin_tree','activity_modules','admin','course_list');
-        $outmodedblocksstring = '\''.join('\',\'',$outmodedblocks).'\'';
+        $outmodedblocksstring = '\''.implode('\',\'',$outmodedblocks).'\'';
         unset($outmodedblocks);
         // Retrieve the block instance id's and parent contexts, so we can join them an GREATLY
         // cut down the number of delete queries we will need to run
@@ -2122,7 +2122,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
                 // If we have more than 1000 block instances now remove all block positions
                 // and empty the array
                 if (count($contextids) > 1000) {
-                    $instanceidstring = join(',',$instanceids);
+                    $instanceidstring = implode(',',$instanceids);
                     $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
                     $instanceids = array();
                 }
@@ -2131,7 +2131,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
 
         upgrade_cleanup_unwanted_block_contexts($contextids);
 
-        $instanceidstring = join(',',$instanceids);
+        $instanceidstring = implode(',',$instanceids);
         $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
 
         unset($allblockinstances);
diff --git a/lib/db/upgradelib.php b/lib/db/upgradelib.php
index 27e797f..9499da9 100644
--- a/lib/db/upgradelib.php
+++ b/lib/db/upgradelib.php
@@ -580,7 +580,7 @@ function upgrade_cleanup_unwanted_block_contexts($contextidarray) {
         return;
     }
 
-    $contextidstring = join(',', $contextidarray);
+    $contextidstring = implode(',', $contextidarray);
 
     $blockcontexts = $DB->get_recordset_select('context', 'contextlevel = '.CONTEXT_BLOCK.' AND id IN ('.$contextidstring.')', array(), '', 'id, contextlevel');
     $blockcontextids = array();
@@ -593,7 +593,7 @@ function upgrade_cleanup_unwanted_block_contexts($contextidarray) {
         return;
     }
 
-    $blockcontextidsstring = join(',', $blockcontextids);
+    $blockcontextidsstring = implode(',', $blockcontextids);
 
     $DB->delete_records_select('role_assignments', 'contextid IN ('.$blockcontextidsstring.')');
     $DB->delete_records_select('role_capabilities', 'contextid IN ('.$blockcontextidsstring.')');
diff --git a/lib/enrollib.php b/lib/enrollib.php
index 1bb1ca3..2265b48 100644
--- a/lib/enrollib.php
+++ b/lib/enrollib.php
@@ -525,7 +525,7 @@ function enrol_get_my_courses($fields = NULL, $sort = 'visible DESC,sortorder AS
         $params['loginas'] = $USER->loginascontext->instanceid;
     }
 
-    $coursefields = 'c.' .join(',c.', $fields);
+    $coursefields = 'c.' .implode(',c.', $fields);
     list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
     $wheres = implode(" AND ", $wheres);
 
@@ -694,7 +694,7 @@ function enrol_get_users_courses($userid, $onlyactive = false, $fields = NULL, $
         $subwhere = "";
     }
 
-    $coursefields = 'c.' .join(',c.', $fields);
+    $coursefields = 'c.' .implode(',c.', $fields);
     list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
 
     //note: we can not use DISTINCT + text fields due to Oracle and MS limitations, that is why we have the subselect there
diff --git a/lib/environmentlib.php b/lib/environmentlib.php
index f530b04..55bb846 100644
--- a/lib/environmentlib.php
+++ b/lib/environmentlib.php
@@ -274,7 +274,7 @@ function print_moodle_environment($result, $environment_results) {
             if (empty($CFG->docroot)) {
                 $report = get_string($stringtouse, 'admin', $rec);
             } else {
-                $report = $OUTPUT->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
+                $report = $OUTPUT->doc_link(implode($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
             }
 
 
diff --git a/lib/filterlib.php b/lib/filterlib.php
index e99d558..c5df952 100644
--- a/lib/filterlib.php
+++ b/lib/filterlib.php
@@ -1024,7 +1024,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
     filter_save_tags($text,$tags);
 
 /// Time to cycle through each phrase to be linked
-    $size = sizeof($link_array);
+    $size = count($link_array);
     for ($n=0; $n < $size; $n++) {
         $linkobject =& $link_array[$n];
 
diff --git a/lib/form/selectgroups.php b/lib/form/selectgroups.php
index 01ee9ed..f5d96b6 100644
--- a/lib/form/selectgroups.php
+++ b/lib/form/selectgroups.php
@@ -457,7 +457,7 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element {
                 }
             }
         }
-        $html = empty($value)? '&nbsp;': join('<br />', $value);
+        $html = empty($value)? '&nbsp;': implode('<br />', $value);
         if ($this->_persistantFreeze) {
             $name = $this->getPrivateName();
             // Only use id attribute if doing single hidden input
diff --git a/lib/formslib.php b/lib/formslib.php
index 91e49bd..7bfb1b9 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -1772,7 +1772,7 @@ function validate_' . $this->_formName . '_' . $escapedElementName . '(element)
   while (frm && frm.nodeName.toUpperCase() != "FORM") {
     frm = frm.parentNode;
   }
-' . join("\n", $jsArr) . '
+' . implode("\n", $jsArr) . '
   return qf_errorHandler(element, _qfMsg);
 }
 ';
diff --git a/lib/graphlib.php b/lib/graphlib.php
index d801378..6a72da7 100644
--- a/lib/graphlib.php
+++ b/lib/graphlib.php
@@ -1090,7 +1090,7 @@ class graph {
 
       // check whether to treat x axis as numeric
       if ($this->parameter['x_axis_gridlines'] == 'auto') { // auto means text based x_axis, not numeric...
-        $this->calculated['x_axis']['num_ticks'] = sizeof($this->x_data);
+        $this->calculated['x_axis']['num_ticks'] = count($this->x_data);
           $data = $this->x_data;
           for ($i=0; $i < $this->calculated['x_axis']['num_ticks']; $i++) {
             $value = array_shift($data); // grab value from begin of array
@@ -1148,7 +1148,7 @@ class graph {
 
     // find max and min values for a data array given the resolution.
     function find_range($data, $min, $max, $resolution) {
-      if (sizeof($data) == 0 ) return array('min' => 0, 'max' => 0);
+      if (count($data) == 0 ) return array('min' => 0, 'max' => 0);
       foreach ($data as $key => $value) {
         if ($value=='none') continue;
         if ($value > $max) $max = $value;
diff --git a/lib/listlib.php b/lib/listlib.php
index 7a3979b..631798e 100644
--- a/lib/listlib.php
+++ b/lib/listlib.php
@@ -515,7 +515,7 @@ abstract class list_item {
         } elseif (is_object($this->item)) {
             //for debug purposes only. You should create a sub class to
             //properly handle the record
-            $html = join(', ', (array)$this->item);
+            $html = implode(', ', (array)$this->item);
         }
         return $html;
     }
@@ -539,7 +539,7 @@ abstract class list_item {
         } else {
             $childrenhtml = '';
         }
-        return $this->item_html($extraargs).'&nbsp;'.(join($this->icons, '')).(($childrenhtml !='')?("\n".$childrenhtml):'');
+        return $this->item_html($extraargs).'&nbsp;'.(implode($this->icons, '')).(($childrenhtml !='')?("\n".$childrenhtml):'');
     }
 
     public function set_icon_html($first, $last, $lastitem) {
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index 6824ee6..a2ff245 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -3749,7 +3749,7 @@ class navigation_json {
         }
 
         if (count($child->classes)>0) {
-            $attributes['class'] .= ' '.join(' ',$child->classes);
+            $attributes['class'] .= ' '.implode(' ',$child->classes);
         }
         if (is_string($child->action)) {
             $attributes['link'] = $child->action;
diff --git a/lib/odbc.php b/lib/odbc.php
index 3c773a3..d1ba53d 100644
--- a/lib/odbc.php
+++ b/lib/odbc.php
@@ -60,7 +60,7 @@ class ODBCSocketServer {
             $sSQL = HTMLSpecialChars($sSQL);
             $sSend = "<?xml version=\"1.0\"?>\r\n<request>\r\n<connectionstring>$this->sConnectionString</connectionstring>\r\n<sql>$sSQL</sql>\r\n</request>\r\n";
             //write request
-            fputs($fToOpen, $sSend);
+            fwrite($fToOpen, $sSend);
             //now read response
             while (!feof($fToOpen))
             {
diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
index d7516e1..3ff45cf 100644
--- a/lib/outputrenderers.php
+++ b/lib/outputrenderers.php
@@ -2344,7 +2344,7 @@ EOD;
             if ($item->isactive === true) {
                 $liclasses[] = 'current_branch';
             }
-            $liattr = array('class'=>join(' ',$liclasses));
+            $liattr = array('class'=>implode(' ',$liclasses));
             // class attribute on the div item which only contains the item content
             $divclasses = array('tree_item');
             if ($item->children->count()>0  || $item->nodetype==navigation_node::NODETYPE_BRANCH) {
@@ -2353,9 +2353,9 @@ EOD;
                 $divclasses[] = 'leaf';
             }
             if (!empty($item->classes) && count($item->classes)>0) {
-                $divclasses[] = join(' ', $item->classes);
+                $divclasses[] = implode(' ', $item->classes);
             }
-            $divattr = array('class'=>join(' ', $divclasses));
+            $divattr = array('class'=>implode(' ', $divclasses));
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
@@ -2393,7 +2393,7 @@ EOD;
 
         //accessibility: heading for navbar list  (MDL-20446)
         $navbarcontent = html_writer::tag('span', get_string('pagepath'), array('class'=>'accesshide'));
-        $navbarcontent .= html_writer::tag('ul', join('', $htmlblocks));
+        $navbarcontent .= html_writer::tag('ul', implode('', $htmlblocks));
         // XHTML
         return $navbarcontent;
     }
diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php
index 2e1e782..88807e9 100644
--- a/lib/outputrequirementslib.php
+++ b/lib/outputrequirementslib.php
@@ -720,7 +720,7 @@ class page_requirements_manager {
             // Set Y's config.gallery to the version
             $jscode = 'Y.config.gallery='.json_encode($galleryversion).';';
         }
-        $jscode .= 'Y.use('.join(',', array_map('json_encode', $modules)).',function() {'.js_writer::function_call($function, $arguments).'})';
+        $jscode .= 'Y.use('.implode(',', array_map('json_encode', $modules)).',function() {'.js_writer::function_call($function, $arguments).'})';
         if ($ondomready) {
             $jscode = "Y.on('domready', function() { $jscode });";
         }
diff --git a/lib/pagelib.php b/lib/pagelib.php
index 7764aba..b551039 100644
--- a/lib/pagelib.php
+++ b/lib/pagelib.php
@@ -1388,7 +1388,7 @@ class moodle_page {
 
         $pathbits = explode('-', trim($pagetype));
         for ($i=1;$i<count($pathbits);$i++) {
-            $this->add_body_class('path-'.join('-',array_slice($pathbits, 0, $i)));
+            $this->add_body_class('path-'.implode('-',array_slice($pathbits, 0, $i)));
         }
 
         $this->add_body_classes(get_browser_version_classes());
diff --git a/lib/phpmailer/moodle_phpmailer.php b/lib/phpmailer/moodle_phpmailer.php
index ff38155..be6727b 100644
--- a/lib/phpmailer/moodle_phpmailer.php
+++ b/lib/phpmailer/moodle_phpmailer.php
@@ -119,7 +119,7 @@ class moodle_phpmailer extends PHPMailer {
         $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks
         $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE);
         $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params);
-        fputs($fp, $string);
+        fwrite($fp, $string);
         rewind($fp);
         $out = stream_get_contents($fp);
         stream_filter_remove($s);
diff --git a/lib/questionlib.php b/lib/questionlib.php
index dc3805f..f30af7a 100644
--- a/lib/questionlib.php
+++ b/lib/questionlib.php
@@ -2487,7 +2487,7 @@ function question_category_options($contexts, $top = false, $currentcat = 0, $po
     foreach($contexts as $context){
         $pcontexts[] = $context->id;
     }
-    $contextslist = join($pcontexts, ', ');
+    $contextslist = implode($pcontexts, ', ');
 
     $categories = get_categories_for_contexts($contextslist);
 
@@ -3049,7 +3049,7 @@ class question_edit_contexts {
      */
      public function require_one_cap($caps) {
         if (!$this->have_one_cap($caps)) {
-            $capsstring = join($caps, ', ');
+            $capsstring = implode($caps, ', ');
             print_error('nopermissions', '', '', $capsstring);
         }
     }
diff --git a/lib/simplepie/simplepie.class.php b/lib/simplepie/simplepie.class.php
index 2aeb1ff..6bbc396 100644
--- a/lib/simplepie/simplepie.class.php
+++ b/lib/simplepie/simplepie.class.php
@@ -2798,7 +2798,7 @@ class SimplePie
 	 */
 	public function merge_items($urls, $start = 0, $end = 0, $limit = 0)
 	{
-		if (is_array($urls) && sizeof($urls) > 0)
+		if (is_array($urls) && count($urls) > 0)
 		{
 			$items = array();
 			foreach ($urls as $arg)
@@ -3808,16 +3808,16 @@ class SimplePie_Item
 				if (isset($duration_parent[0]['data']))
 				{
 					$temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
-					if (sizeof($temp) > 0)
+					if (count($temp) > 0)
 					{
 						$seconds = (int) array_pop($temp);
 					}
-					if (sizeof($temp) > 0)
+					if (count($temp) > 0)
 					{
 						$minutes = (int) array_pop($temp);
 						$seconds += $minutes * 60;
 					}
-					if (sizeof($temp) > 0)
+					if (count($temp) > 0)
 					{
 						$hours = (int) array_pop($temp);
 						$seconds += $hours * 3600;
@@ -5304,7 +5304,7 @@ class SimplePie_Item
 				}
 			}
 
-			if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
+			if (count($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
 			{
 				// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
 				$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
@@ -8302,7 +8302,7 @@ class SimplePie_Cache_File
 
 	public function save($data)
 	{
-		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
+		if (file_exists($this->name) && is_writable($this->name) || file_exists($this->location) && is_writable($this->location))
 		{
 			if (is_a($data, 'SimplePie'))
 			{
diff --git a/lib/webdavlib.php b/lib/webdavlib.php
index 4eddc7d..b276362 100644
--- a/lib/webdavlib.php
+++ b/lib/webdavlib.php
@@ -304,7 +304,7 @@ class webdav_client {
         // send header
         $this->send_request();
         // send the rest (data)
-        fputs($this->sock, $data);
+        fwrite($this->sock, $data);
         $this->get_respond();
         $response = $this->process_respond();
 
@@ -350,7 +350,7 @@ class webdav_client {
             // send header
             $this->send_request();
             while (!feof($handle)) {
-                fputs($this->sock,fgets($handle,4096));
+                fwrite($this->sock,fgets($handle,4096));
             }
             fclose($handle);
             $this->get_respond();
@@ -480,7 +480,7 @@ class webdav_client {
         $this->header_add('Content-type: application/xml');
         $this->send_request();
         // send also xml
-        fputs($this->sock, $xml);
+        fwrite($this->sock, $xml);
         $this->get_respond();
         $response = $this->process_respond();
         // validate the response ...
@@ -591,7 +591,7 @@ class webdav_client {
         $this->header_add('Content-length: ' . strlen($xml));
         $this->send_request();
         // send also xml
-        fputs($this->sock, $xml);
+        fwrite($this->sock, $xml);
         $this->get_respond();
         $response = $this->process_respond();
         // validate the response ... (only basic validation)
@@ -784,7 +784,7 @@ EOD;
         $this->header_add('Content-length: ' . strlen($xml));
         $this->send_request();
         $this->_error_log($xml);
-        fputs($this->sock, $xml);
+        fwrite($this->sock, $xml);
         $this->get_respond();
         $response = $this->process_respond();
         // validate the response ... (only basic validation)
@@ -1323,7 +1323,7 @@ EOD;
         $buffer = implode("\r\n", $this->_req);
         $buffer .= "\r\n\r\n";
         $this->_error_log($buffer);
-        fputs($this->sock, $buffer);
+        fwrite($this->sock, $buffer);
     }
 
     /**
diff --git a/lib/weblib.php b/lib/weblib.php
index 6141c11..48d533c 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -1818,7 +1818,7 @@ function highlightfast($needle, $haystack) {
         $pos += strlen($needle);
     }
 
-    return str_replace('<span class="highlight"></span>', '', join('', $parts));
+    return str_replace('<span class="highlight"></span>', '', implode('', $parts));
 }
 
 /**
@@ -3277,7 +3277,7 @@ function print_password_policy() {
             $messages[] = get_string('informminpasswordnonalphanum', 'auth', $CFG->minpasswordnonalphanum);
         }
 
-        $messages = join(', ', $messages); // this is ugly but we do not have anything better yet...
+        $messages = implode(', ', $messages); // this is ugly but we do not have anything better yet...
         $message = get_string('informpasswordpolicy', 'auth', $messages);
     }
     return $message;
diff --git a/lib/xmldb/xmldb_file.php b/lib/xmldb/xmldb_file.php
index 92fa9b1..97c6bf2 100644
--- a/lib/xmldb/xmldb_file.php
+++ b/lib/xmldb/xmldb_file.php
@@ -56,7 +56,7 @@ class xmldb_file extends xmldb_object {
      * Determine if the XML is writeable
      */
     function fileWriteable() {
-        if (is_writeable(dirname($this->path))) {
+        if (is_writable(dirname($this->path))) {
             return true;
         }
         return false;
diff --git a/lib/xmlize.php b/lib/xmlize.php
index 88efff4..c657b8a 100644
--- a/lib/xmlize.php
+++ b/lib/xmlize.php
@@ -139,7 +139,7 @@ function xml_depth($vals, &$i) {
 
                 if ( isset ( $children[$tagname] ) )
                 {
-                    $size = sizeof($children[$tagname]);
+                    $size = count($children[$tagname]);
                 } else {
                     $size = 0;
                 }
@@ -163,7 +163,7 @@ function xml_depth($vals, &$i) {
 
                 if( isset ($children[$tagname]) )
                 {
-                    $size = sizeof($children[$tagname]);
+                    $size = count($children[$tagname]);
                 } else {
                     $size = 0;
                 }
diff --git a/mnet/xmlrpc/client.php b/mnet/xmlrpc/client.php
index 02a7cdc..bf4ac4b 100644
--- a/mnet/xmlrpc/client.php
+++ b/mnet/xmlrpc/client.php
@@ -37,7 +37,7 @@ class mnet_xmlrpc_client {
      * $return  bool            True if param is an integer or integer string
      */
     function set_timeout($timeout) {
-        if (!is_integer($timeout)) {
+        if (!is_int($timeout)) {
             if (is_numeric($timeout)) {
                 $this->timeout = (integer)$timeout;
                 return true;
diff --git a/mod/data/field/latlong/field.class.php b/mod/data/field/latlong/field.class.php
index 794f3d0..ad36978 100644
--- a/mod/data/field/latlong/field.class.php
+++ b/mod/data/field/latlong/field.class.php
@@ -145,11 +145,11 @@ class data_field_latlong extends data_field_base {
                 '@recordid@'=> $content->recordid,
             );
 
-            if(sizeof($servicesshown)==1 && $servicesshown[0]) {
+            if(count($servicesshown)==1 && $servicesshown[0]) {
                 $str .= " <a href='"
                           . str_replace(array_keys($urlreplacements), array_values($urlreplacements), $this->linkoutservices[$servicesshown[0]])
                           ."' title='$servicesshown[0]'>$compasslat, $compasslong</a>";
-            } elseif (sizeof($servicesshown)>1) {
+            } elseif (count($servicesshown)>1) {
                 $str .= "$compasslat, $compasslong\n<select name='jumpto'>";
                 foreach($servicesshown as $servicename){
                     // Add a link to a service
diff --git a/mod/data/field/latlong/mod.html b/mod/data/field/latlong/mod.html
index fb34fb4..f2f5905 100644
--- a/mod/data/field/latlong/mod.html
+++ b/mod/data/field/latlong/mod.html
@@ -10,7 +10,7 @@
     <tr>
         <td class="c0"><label for="param1"><?php echo get_string('latlonglinkservicesdisplayed', 'data'); ?></label></td>
         <td class="c1">
-          <select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php p(sizeof($this->linkoutservices)); ?>">
+          <select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php p(count($this->linkoutservices)); ?>">
             <?php
             $serviceschosen = explode(',', htmlspecialchars($this->field->param1));
             foreach($this->linkoutservices as $servicename=>$serviceurl) {
@@ -30,7 +30,7 @@
             <?php
                 // Fetch all "suitable" other fields that exist for this database
                 $textfields = $DB->get_records('data_fields', array('dataid'=>$this->data->id, 'type'=>'text'));
-                if(sizeof($textfields)>0) {
+                if(count($textfields)>0) {
                 echo '<optgroup label="'.get_string('latlongotherfields', 'data').':">';
                     foreach($textfields as $textfield) {
                         echo "<option value='$textfield->id'".($this->field->param2==$textfield->id ? ' selected="selected"' : '').">$textfield->name</option>";
diff --git a/mod/feedback/analysis.php b/mod/feedback/analysis.php
index 78f46d5..133fa87 100644
--- a/mod/feedback/analysis.php
+++ b/mod/feedback/analysis.php
@@ -109,7 +109,7 @@ echo '<b>'.get_string('completed_feedbacks', 'feedback').': '.$completedscount.
 $items = $DB->get_records('feedback_item', array('feedback'=>$feedback->id, 'hasvalue'=>1), 'position');
 //show the count
 if(is_array($items)){
-    echo '<b>'.get_string('questions', 'feedback').': ' .sizeof($items). ' </b><hr />';
+    echo '<b>'.get_string('questions', 'feedback').': ' .count($items). ' </b><hr />';
 } else {
     $items=array();
 }
diff --git a/mod/feedback/analysis_course.php b/mod/feedback/analysis_course.php
index b1743a6..e8efd2d 100644
--- a/mod/feedback/analysis_course.php
+++ b/mod/feedback/analysis_course.php
@@ -101,7 +101,7 @@ echo '<b>'.get_string('completed_feedbacks', 'feedback').': '.$completedscount.
 $items = $DB->get_records('feedback_item', array('feedback'=>$feedback->id, 'hasvalue'=>1), 'position');
 //show the count
 if(is_array($items)){
-    echo '<b>'.get_string('questions', 'feedback').': ' .sizeof($items). ' </b><hr />';
+    echo '<b>'.get_string('questions', 'feedback').': ' .count($items). ' </b><hr />';
     echo '<a href="analysis_course.php?id=' . $id . '&courseid='.$courseid.'">'.get_string('show_all', 'feedback').'</a>';
 } else {
     $items=array();
diff --git a/mod/feedback/analysis_to_excel.php b/mod/feedback/analysis_to_excel.php
index 33920e5..8883ca8 100644
--- a/mod/feedback/analysis_to_excel.php
+++ b/mod/feedback/analysis_to_excel.php
@@ -171,7 +171,7 @@ if($completedscount > 0){
 
 if(is_array($items)){
     $rowOffset1++;
-    $worksheet1->write_string($rowOffset1, 0, $fstring->questions.': '. strval(sizeof($items)), $xlsFormats->head1);
+    $worksheet1->write_string($rowOffset1, 0, $fstring->questions.': '. strval(count($items)), $xlsFormats->head1);
 }
 
 $rowOffset1 += 2;
diff --git a/mod/feedback/item/info/lib.php b/mod/feedback/item/info/lib.php
index b6311a8..c5d633a 100644
--- a/mod/feedback/item/info/lib.php
+++ b/mod/feedback/item/info/lib.php
@@ -130,7 +130,7 @@ class feedback_item_info extends feedback_item_base {
         $data = $analysed_item->data;
         if (is_array($data)) {
             echo '<tr><th colspan="2" align="left">'. $itemnr . '&nbsp;('. $item->label .') ' . $item->name .'</th></tr>';
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for ($i = 0; $i < $sizeofdata; $i++) {
                 echo '<tr><td colspan="2" valign="top" align="left">-&nbsp;&nbsp;' . str_replace("\n", '<br />', $data[$i]->show) . '</td></tr>';
             }
@@ -149,7 +149,7 @@ class feedback_item_info extends feedback_item_base {
             // $worksheet->setFormat("<l><ro2><vo>");
             $worksheet->write_string($rowOffset, 2, $data[0]->show, $xlsFormats->value_bold);
             $rowOffset++;
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for ($i = 1; $i < $sizeofdata; $i++) {
                 // $worksheet->setFormat("<l><vo>");
                 $worksheet->write_string($rowOffset, 2, $data[$i]->show, $xlsFormats->default);
diff --git a/mod/feedback/item/multichoice/lib.php b/mod/feedback/item/multichoice/lib.php
index ec7102d..e0c772e 100644
--- a/mod/feedback/item/multichoice/lib.php
+++ b/mod/feedback/item/multichoice/lib.php
@@ -119,7 +119,7 @@ class feedback_item_multichoice extends feedback_item_base {
 
         $analysedAnswer = array();
         if($info->subtype == 'c') {
-            $sizeofanswers = sizeof($answers);
+            $sizeofanswers = count($answers);
             for ($i = 1; $i <= $sizeofanswers; $i++) {
                 $ans = null;
                 $ans->answertext = $answers[$i-1];
@@ -133,11 +133,11 @@ class feedback_item_multichoice extends feedback_item_base {
                         }
                     }
                 }
-                $ans->quotient = $ans->answercount / sizeof($values);
+                $ans->quotient = $ans->answercount / count($values);
                 $analysedAnswer[] = $ans;
             }
         }else {
-            $sizeofanswers = sizeof($answers);
+            $sizeofanswers = count($answers);
             for ($i = 1; $i <= $sizeofanswers; $i++) {
                 $ans = null;
                 $ans->answertext = $answers[$i-1];
@@ -148,7 +148,7 @@ class feedback_item_multichoice extends feedback_item_base {
                         $ans->answercount++;
                     }
                 }
-                $ans->quotient = $ans->answercount / sizeof($values);
+                $ans->quotient = $ans->answercount / count($values);
                 $analysedAnswer[] = $ans;
             }
         }
@@ -171,8 +171,8 @@ class feedback_item_multichoice extends feedback_item_base {
 
         if ($info->subtype == 'c') {
             $vallist = array_values(explode (FEEDBACK_MULTICHOICE_LINE_SEP, $value->value));
-            $sizeofvallist = sizeof($vallist);
-            $sizeofpresentation = sizeof($presentation);
+            $sizeofvallist = count($vallist);
+            $sizeofpresentation = count($presentation);
             for ($i = 0; $i < $sizeofvallist; $i++) {
                 for ($k = 0; $k < $sizeofpresentation; $k++) {
                     if ($vallist[$i] == ($k + 1)) {//Die Werte beginnen bei 1, das Array aber mit 0
@@ -238,7 +238,7 @@ class feedback_item_multichoice extends feedback_item_base {
         $worksheet->write_string($rowOffset, 0, $item->label, $xlsFormats->head2_green);
         $worksheet->write_string($rowOffset, 1, $analysed_item[1], $xlsFormats->head2_green);
         if (is_array($data)) {
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for ($i = 0; $i < $sizeofdata; $i++) {
                 $aData = $data[$i];
 
@@ -574,7 +574,7 @@ class feedback_item_multichoice extends feedback_item_base {
         $arrvals = array_values($value);
         $arrvals = clean_param($arrvals, PARAM_INT);  //prevent sql-injection
         $retval = $arrvals[0];
-        $sizeofarrvals = sizeof($arrvals);
+        $sizeofarrvals = count($arrvals);
         for ($i = 1; $i < $sizeofarrvals; $i++) {
             $retval .= FEEDBACK_MULTICHOICE_LINE_SEP.$arrvals[$i];
         }
diff --git a/mod/feedback/item/multichoicerated/lib.php b/mod/feedback/item/multichoicerated/lib.php
index 77a2b04..5877bf1 100644
--- a/mod/feedback/item/multichoicerated/lib.php
+++ b/mod/feedback/item/multichoicerated/lib.php
@@ -120,7 +120,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
         //schleife ueber den Werten und ueber die Antwortmoeglichkeiten
 
         $analysedAnswer = array();
-        $sizeoflines = sizeof($lines);
+        $sizeoflines = count($lines);
         for($i = 1; $i <= $sizeoflines; $i++) {
             $item_values = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $lines[$i-1]);
             $ans = null;
@@ -135,9 +135,9 @@ class feedback_item_multichoicerated extends feedback_item_base {
                 }
             }
             $ans->answercount = $anscount;
-            $ans->avg = doubleval($avg) / doubleval(sizeof($values));
+            $ans->avg = doubleval($avg) / doubleval(count($values));
             $ans->value = $item_values[0];
-            $ans->quotient = $ans->answercount / sizeof($values);
+            $ans->quotient = $ans->answercount / count($values);
             $analysedAnswer[] = $ans;
         }
         $analysedItem[] = $analysedAnswer;
@@ -215,7 +215,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
         $worksheet->write_string($rowOffset, 1, $analysed_item[1], $xlsFormats->head2);
         if(is_array($data)) {
             $avg = 0.0;
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for($i = 0; $i < $sizeofdata; $i++) {
                 $aData = $data[$i];
 
@@ -230,10 +230,10 @@ class feedback_item_multichoicerated extends feedback_item_base {
             }
             //mittelwert anzeigen
             // $worksheet->setFormat("<l><f><ro2><vo><c:red>");
-            $worksheet->write_string($rowOffset, sizeof($data) + 2, get_string('average', 'feedback'), $xlsFormats->value_bold);
+            $worksheet->write_string($rowOffset, count($data) + 2, get_string('average', 'feedback'), $xlsFormats->value_bold);
 
             // $worksheet->setFormat("<l><f><vo>");
-            $worksheet->write_number($rowOffset + 1, sizeof($data) + 2, $avg, $xlsFormats->value_bold);
+            $worksheet->write_number($rowOffset + 1, count($data) + 2, $avg, $xlsFormats->value_bold);
         }
         $rowOffset +=2 ;
         return $rowOffset;
diff --git a/mod/feedback/item/textarea/lib.php b/mod/feedback/item/textarea/lib.php
index 1b4cd13..9ebfaa7 100644
--- a/mod/feedback/item/textarea/lib.php
+++ b/mod/feedback/item/textarea/lib.php
@@ -142,7 +142,7 @@ class feedback_item_textarea extends feedback_item_base {
                 $worksheet->write_string($rowOffset, 2, $data[0], $xlsFormats->value_bold);
             }
             $rowOffset++;
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for($i = 1; $i < $sizeofdata; $i++) {
                 // $worksheet->setFormat("<l><vo>");
                 $worksheet->write_string($rowOffset, 2, $data[$i], $xlsFormats->default);
diff --git a/mod/feedback/item/textfield/lib.php b/mod/feedback/item/textfield/lib.php
index 74f9b88..91de1ef 100644
--- a/mod/feedback/item/textfield/lib.php
+++ b/mod/feedback/item/textfield/lib.php
@@ -139,7 +139,7 @@ class feedback_item_textfield extends feedback_item_base {
             // $worksheet->setFormat("<l><ro2><vo>");
             $worksheet->write_string($rowOffset, 2, $data[0], $xlsFormats->value_bold);
             $rowOffset++;
-            $sizeofdata = sizeof($data);
+            $sizeofdata = count($data);
             for($i = 1; $i < $sizeofdata; $i++) {
                 // $worksheet->setFormat("<l><vo>");
                 $worksheet->write_string($rowOffset, 2, $data[$i], $xlsFormats->default);
diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php
index 1d238e9..681e062 100644
--- a/mod/feedback/lib.php
+++ b/mod/feedback/lib.php
@@ -2300,7 +2300,7 @@ function feedback_get_completeds_group_count($feedback, $groupid = false, $cours
         return false;
     }
     if($values = feedback_get_completeds_group($feedback, $groupid)) {
-        return sizeof($values);
+        return count($values);
     }else {
         return false;
     }
diff --git a/mod/glossary/import.php b/mod/glossary/import.php
index 9a20c88..315eae4 100644
--- a/mod/glossary/import.php
+++ b/mod/glossary/import.php
@@ -187,7 +187,7 @@ if ($xml = glossary_read_imported_file($result)) {
     }
 
     $xmlentries = $xml['GLOSSARY']['#']['INFO'][0]['#']['ENTRIES'][0]['#']['ENTRY'];
-    $sizeofxmlentries = sizeof($xmlentries);
+    $sizeofxmlentries = count($xmlentries);
     for($i = 0; $i < $sizeofxmlentries; $i++) {
         // Inserting the entries
         $xmlentry = $xmlentries[$i];
@@ -248,7 +248,7 @@ if ($xml = glossary_read_imported_file($result)) {
             $importedentries++;
 
             $xmlaliases = @$xmlentry['#']['ALIASES'][0]['#']['ALIAS']; // ignore missing ALIASES
-            $sizeofxmlaliases = sizeof($xmlaliases);
+            $sizeofxmlaliases = count($xmlaliases);
             for($k = 0; $k < $sizeofxmlaliases; $k++) {
             /// Importing aliases
                 $xmlalias = $xmlaliases[$k];
@@ -265,7 +265,7 @@ if ($xml = glossary_read_imported_file($result)) {
             if (!empty($data->catsincl)) {
                 // If the categories must be imported...
                 $xmlcats = @$xmlentry['#']['CATEGORIES'][0]['#']['CATEGORY']; // ignore missing CATEGORIES
-                $sizeofxmlcats = sizeof($xmlcats);
+                $sizeofxmlcats = count($xmlcats);
                 for($k = 0; $k < $sizeofxmlcats; $k++) {
                     $xmlcat = $xmlcats[$k];
 
diff --git a/mod/lesson/format.php b/mod/lesson/format.php
index 5a2ea0c..baa5b81 100644
--- a/mod/lesson/format.php
+++ b/mod/lesson/format.php
@@ -309,7 +309,7 @@ class qformat_default {
             return false;
         }
 
-        echo $OUTPUT->notification(get_string('importcount', 'lesson', sizeof($questions)));
+        echo $OUTPUT->notification(get_string('importcount', 'lesson', count($questions)));
 
         $count = 0;
 
diff --git a/mod/quiz/report/statistics/qstats.php b/mod/quiz/report/statistics/qstats.php
index cb2e05e..1ff0069 100644
--- a/mod/quiz/report/statistics/qstats.php
+++ b/mod/quiz/report/statistics/qstats.php
@@ -214,7 +214,7 @@ class qstats{
             }
             if ($this->subquestions[$qid]->_stats->usedin){
                 sort($this->subquestions[$qid]->_stats->usedin, SORT_NUMERIC);
-                $this->subquestions[$qid]->_stats->positions = join($this->subquestions[$qid]->_stats->usedin, ',');
+                $this->subquestions[$qid]->_stats->positions = implode($this->subquestions[$qid]->_stats->usedin, ',');
             } else {
                 $this->subquestions[$qid]->_stats->positions = '';
             }
@@ -236,7 +236,7 @@ class qstats{
                     }
                 }
                 if (isset($this->randomselectors[$randomselectorstring])){
-                    $question->_stats->subquestions = join($this->randomselectors[$randomselectorstring], ',');
+                    $question->_stats->subquestions = implode($this->randomselectors[$randomselectorstring], ',');
                 }
             }
         } while ($nextquestion);
diff --git a/mod/scorm/datamodels/sequencinglib.php b/mod/scorm/datamodels/sequencinglib.php
index 3a2f001..01e6881 100644
--- a/mod/scorm/datamodels/sequencinglib.php
+++ b/mod/scorm/datamodels/sequencinglib.php
@@ -459,7 +459,7 @@ function scorm_seq_rule_check ($sco, $rule){
         return $cond;
     }
 
-    $size= sizeof($bag);
+    $size= count($bag);
     $i=0;
 
     if ($rule->conditioncombination = 'all'){
@@ -819,7 +819,7 @@ function scorm_seq_rollup_rule_check ($sco,$userid,$action){
                         if($itm === true){
                             $cont++;
                         }
-                        if(($cont/sizeof($childrenbag)) >= $rolluprule->minimumcount){
+                        if(($cont/count($childrenbag)) >= $rolluprule->minimumcount){
                             $change = true;
                         }
                     }
@@ -1384,7 +1384,7 @@ function scorm_seq_flow_tree_traversal ($activity,$direction,$childrenflag,$prev
     $revdirection = false;
     $parent = scorm_get_parent ($activity);
     $children = scorm_get_available_children ($parent);
-    $siz = sizeof ($children);
+    $siz = count ($children);
 
     if (($prevdirection != null && $prevdirection == 'backward') && ($children[$siz-1]->id == $activity->id)){
         $direction = 'backward';
@@ -1396,7 +1396,7 @@ function scorm_seq_flow_tree_traversal ($activity,$direction,$childrenflag,$prev
         $ancestors = scorm_get_ancestors($activity);
         $ancestorsroot = array_reverse($ancestors);
         $preorder = scorm_get_preorder ($ancestorsroot);
-        $siz= sizeof ($preorder);
+        $siz= count ($preorder);
         if (($activity->id == $preorder[$siz-1]->id) || (($activity->parent == '/') && !($childrenflag))){
             scorm_seq_terminate_descent($ancestorsroot,$userid);
             $seq->endsession = true;
@@ -1416,7 +1416,7 @@ function scorm_seq_flow_tree_traversal ($activity,$direction,$childrenflag,$prev
                 $sib = scorm_get_siblings($activity);
                 $pos = array_search($sib, $activity);
                 if ($pos !== false) {
-                    if ($pos != sizeof ($sib)){
+                    if ($pos != count ($sib)){
                         $seq->nextactivity = $sib [$pos+1];
                         return $seq;
                     }
@@ -1490,7 +1490,7 @@ function scorm_seq_flow_tree_traversal ($activity,$direction,$childrenflag,$prev
                  else{
                      $children = scorm_get_children ($activity);
                      $seq->traversaldir = 'backward';
-                     $seq->nextactivity = $children[sizeof($children)-1];
+                     $seq->nextactivity = $children[count($children)-1];
                      return $seq;
                  }
 
@@ -1729,7 +1729,7 @@ function scorm_seq_choice_sequencing($sco,$userid,$seq){
         $i=0;
         foreach ($curtarget as $activ){
             $i++;
-            if ($i != sizeof($curtarget)){
+            if ($i != count($curtarget)){
                 if ( isset($activ->choiceexit) && ($activ->choiceexit == false)){
                     $seq->delivery = null;
                     $seq->exception = 'SB.2.9-7';
@@ -1866,7 +1866,7 @@ function scorm_seq_choice_flow_tree ($constrained, $traverse, $seq){
     $parent = scorm_get_parent ($constrained);
     if ($traverse== 'forward'){
         $preord = scorm_get_preorder ($constrained);
-        if (sizeof($preorder) == 0 || (sizeof($preorder) == 0 && $preorder[0]->id = $constrained->id)){ // TODO: undefined
+        if (count($preorder) == 0 || (count($preorder) == 0 && $preorder[0]->id = $constrained->id)){ // TODO: undefined
             $islast = true;//the function is the last activity available
         }
         if ($constrained->parent == '/' || $islast){
@@ -1874,13 +1874,13 @@ function scorm_seq_choice_flow_tree ($constrained, $traverse, $seq){
             return $seq;
         }
         $avchildren = scorm_get_available_children ($parent);//available children
-        if ($avchildren [sizeof($avchildren)-1]->id == $constrained->id){
+        if ($avchildren [count($avchildren)-1]->id == $constrained->id){
             $seq = scorm_seq_choice_flow_tree ($parent, 'forward', $seq);
             return $seq;
         }
         else{
             $i=0;
-            while($i < sizeof($avchildren)){
+            while($i < count($avchildren)){
                 if ($avchildren [$i]->id == $constrained->id){
                     $seq->nextactivity = $avchildren [$i+1];
                     return $seq;
@@ -1905,7 +1905,7 @@ function scorm_seq_choice_flow_tree ($constrained, $traverse, $seq){
             return $seq;
         }
         else{
-            $i=sizeof($avchildren)-1;
+            $i=count($avchildren)-1;
             while($i >=0){
                 if ($avchildren [$i]->id == $constrained->id){
                     $seq->nextactivity = $avchildren [$i-1];
@@ -2141,7 +2141,7 @@ function scorm_randomize_children_process($scoid,$userid){
                         if(scorm_seq_is('randomizechildren',$scoid,$userid)){
                             $childlist = array();
                             $res = scorm_get_available_children($sco);
-                            $i = sizeof($res)-1;
+                            $i = count($res)-1;
                             $children = $res->value;
 
                             while ($i>=0){
diff --git a/mod/scorm/report.php b/mod/scorm/report.php
index 2a67b7c..671781a 100644
--- a/mod/scorm/report.php
+++ b/mod/scorm/report.php
@@ -169,7 +169,7 @@
                         $nostudents = true;
                         $allowedlist = '';
                     } else {
-                        $allowedlist = join(',',array_keys($students));
+                        $allowedlist = implode(',',array_keys($students));
                     }
                 } else {
                     // all users who can attempt scoes and who are in the currently selected group
@@ -178,7 +178,7 @@
                         $nostudents = true;
                         $groupstudents = array();
                     }
-                    $allowedlist = join(',', array_keys($groupstudents));
+                    $allowedlist = implode(',', array_keys($groupstudents));
                 }
 
                 if( !$nostudents ) {
diff --git a/mod/wiki/diff/diff_nwiki.php b/mod/wiki/diff/diff_nwiki.php
index 3afb0c8..b6adc4f 100644
--- a/mod/wiki/diff/diff_nwiki.php
+++ b/mod/wiki/diff/diff_nwiki.php
@@ -21,11 +21,11 @@ class _WikiDiffOp {
     }
 
     function norig() {
-    	return $this->orig ? sizeof($this->orig) : 0;
+    	return $this->orig ? count($this->orig) : 0;
     }
 
     function nclosing() {
-    	return $this->closing ? sizeof($this->closing) : 0;
+    	return $this->closing ? count($this->closing) : 0;
     }
 }
 
@@ -107,8 +107,8 @@ class _WikiDiffOp_Change extends _WikiDiffOp {
 class _WikiDiffEngine
 {
     function diff ($from_lines, $to_lines) {
-    	$n_from = sizeof($from_lines);
-    	$n_to = sizeof($to_lines);
+    	$n_from = count($from_lines);
+    	$n_to = count($to_lines);
 
     	$this->xchanged = $this->ychanged = array();
     	$this->xv = $this->yv = array();
@@ -151,7 +151,7 @@ class _WikiDiffEngine
     	}
 
     	// Find the LCS.
-    	$this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
+    	$this->_compareseq(0, count($this->xv), 0, count($this->yv));
 
     	// Merge edits when possible
     	$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
@@ -381,9 +381,9 @@ class _WikiDiffEngine
     $i = 0;
     $j = 0;
 
-    USE_ASSERTS_IN_WIKI && assert('sizeof($lines) == sizeof($changed)');
-    $len = sizeof($lines);
-    $other_len = sizeof($other_changed);
+    USE_ASSERTS_IN_WIKI && assert('count($lines) == count($changed)');
+    $len = count($lines);
+    $other_len = count($other_changed);
 
     while (1) {
     	/*
@@ -549,7 +549,7 @@ class WikiDiff
     $lcs = 0;
     	foreach ($this->edits as $edit) {
     		if ($edit->type == 'copy')
-    			$lcs += sizeof($edit->orig);
+    			$lcs += count($edit->orig);
     	}
     return $lcs;
     }
@@ -567,7 +567,7 @@ class WikiDiff
 
     	foreach ($this->edits as $edit) {
     		if ($edit->orig)
-    			array_splice($lines, sizeof($lines), 0, $edit->orig);
+    			array_splice($lines, count($lines), 0, $edit->orig);
     	}
     	return $lines;
     }
@@ -585,7 +585,7 @@ class WikiDiff
 
     	foreach ($this->edits as $edit) {
     		if ($edit->closing)
-    			array_splice($lines, sizeof($lines), 0, $edit->closing);
+    			array_splice($lines, count($lines), 0, $edit->closing);
     	}
     	return $lines;
     }
@@ -653,23 +653,23 @@ extends WikiDiff
     function MappedWikiDiff($from_lines, $to_lines,
     					$mapped_from_lines, $mapped_to_lines) {
 
-    	assert(sizeof($from_lines) == sizeof($mapped_from_lines));
-    	assert(sizeof($to_lines) == sizeof($mapped_to_lines));
+    	assert(count($from_lines) == count($mapped_from_lines));
+    	assert(count($to_lines) == count($mapped_to_lines));
 
     	$this->WikiDiff($mapped_from_lines, $mapped_to_lines);
 
     	$xi = $yi = 0;
-    	for ($i = 0; $i < sizeof($this->edits); $i++) {
+    	for ($i = 0; $i < count($this->edits); $i++) {
     		$orig = &$this->edits[$i]->orig;
     		if (is_array($orig)) {
-    			$orig = array_slice($from_lines, $xi, sizeof($orig));
-    			$xi += sizeof($orig);
+    			$orig = array_slice($from_lines, $xi, count($orig));
+    			$xi += count($orig);
     		}
 
     		$closing = &$this->edits[$i]->closing;
     		if (is_array($closing)) {
-    			$closing = array_slice($to_lines, $yi, sizeof($closing));
-    			$yi += sizeof($closing);
+    			$closing = array_slice($to_lines, $yi, count($closing));
+    			$yi += count($closing);
     		}
     	}
     }
@@ -720,7 +720,7 @@ class WikiDiffFormatter
     	foreach ($diff->edits as $edit) {
     		if ($edit->type == 'copy') {
     			if (is_array($block)) {
-    				if (sizeof($edit->orig) <= $nlead + $ntrail) {
+    				if (count($edit->orig) <= $nlead + $ntrail) {
     					$block[] = $edit;
     				}
     				else{
@@ -738,9 +738,9 @@ class WikiDiffFormatter
     		}
     		else {
     			if (! is_array($block)) {
-    				$context = array_slice($context, sizeof($context) - $nlead);
-    				$x0 = $xi - sizeof($context);
-    				$y0 = $yi - sizeof($context);
+    				$context = array_slice($context, count($context) - $nlead);
+    				$x0 = $xi - count($context);
+    				$y0 = $yi - count($context);
     				$block = array();
     				if ($context)
     					$block[] = new _WikiWikiDiffOp_Copy($context);
@@ -749,9 +749,9 @@ class WikiDiffFormatter
     		}
 
     		if ($edit->orig)
-    			$xi += sizeof($edit->orig);
+    			$xi += count($edit->orig);
     		if ($edit->closing)
-    			$yi += sizeof($edit->closing);
+    			$yi += count($edit->closing);
     	}
 
     	if (is_array($block))
diff --git a/mod/wiki/locallib.php b/mod/wiki/locallib.php
index 91feed2..340711f 100644
--- a/mod/wiki/locallib.php
+++ b/mod/wiki/locallib.php
@@ -1209,7 +1209,7 @@ function wiki_print_page_content($page, $context, $subwikiid) {
             $url = new moodle_url('/tag/index.php', array('tag'=>$tag));
             $links[] = html_writer::link($url, $tag, array('title'=>get_string('tagtitle', 'wiki', $tag)));
         }
-        echo join($links, ", ");
+        echo implode($links, ", ");
         echo $OUTPUT->container_end();
     }
 
diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php
index f49545e..932253d 100644
--- a/mod/wiki/pagelib.php
+++ b/mod/wiki/pagelib.php
@@ -1819,7 +1819,7 @@ class page_wiki_map extends page_wiki {
             if ($item->isactive === true) {
                 $liclasses[] = 'current_branch';
             }
-            $liattr = array('class' => join(' ', $liclasses));
+            $liattr = array('class' => implode(' ', $liclasses));
             // class attribute on the div item which only contains the item content
             $divclasses = array('tree_item');
             if ((empty($expansionlimit) || $item->type != $expansionlimit) && ($item->children->count() > 0 || ($item->nodetype == navigation_node::NODETYPE_BRANCH && $item->children->count() == 0 && isloggedin()))) {
@@ -1828,9 +1828,9 @@ class page_wiki_map extends page_wiki {
                 $divclasses[] = 'leaf';
             }
             if (!empty($item->classes) && count($item->classes) > 0) {
-                $divclasses[] = join(' ', $item->classes);
+                $divclasses[] = implode(' ', $item->classes);
             }
-            $divattr = array('class' => join(' ', $divclasses));
+            $divattr = array('class' => implode(' ', $divclasses));
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
diff --git a/question/editlib.php b/question/editlib.php
index b07ad75..bbb33e2 100644
--- a/question/editlib.php
+++ b/question/editlib.php
@@ -1595,7 +1595,7 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec
     foreach ($contexts->having_one_edit_tab_cap($edittab) as $context){
         $contextlistarr[] = "'$context->id'";
     }
-    $contextlist = join($contextlistarr, ' ,');
+    $contextlist = implode($contextlistarr, ' ,');
     if (!empty($pagevars['cat'])){
         $catparts = explode(',', $pagevars['cat']);
         if (!$catparts[0] || (FALSE !== array_search($catparts[1], $contextlistarr)) ||
diff --git a/question/format/blackboard/format.php b/question/format/blackboard/format.php
index b74b150..0c73e7a 100644
--- a/question/format/blackboard/format.php
+++ b/question/format/blackboard/format.php
@@ -91,7 +91,7 @@ function process_tf($xml, &$questions) {
         return;
     }
 
-    for ($i = 0; $i < sizeof ($tfquestions); $i++) {
+    for ($i = 0; $i < count ($tfquestions); $i++) {
 
         $question = $this->defaultquestion();
 
@@ -144,7 +144,7 @@ function process_mc($xml, &$questions) {
         return;
     }
 
-    for ($i = 0; $i < sizeof ($mcquestions); $i++) {
+    for ($i = 0; $i < count ($mcquestions); $i++) {
 
         $question = $this->defaultquestion();
 
@@ -166,7 +166,7 @@ function process_mc($xml, &$questions) {
         $question->name = shorten_text($question->questiontext, 254);
 
         $choices = $thisquestion["#"]["ANSWER"];
-        for ($j = 0; $j < sizeof ($choices); $j++) {
+        for ($j = 0; $j < count ($choices); $j++) {
 
             $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
             // put this choice in the question object.
@@ -208,7 +208,7 @@ function process_ma($xml, &$questions) {
         return;
     }
 
-    for ($i = 0; $i < sizeof ($maquestions); $i++) {
+    for ($i = 0; $i < count ($maquestions); $i++) {
 
         $question = $this->defaultquestion();
 
@@ -233,13 +233,13 @@ function process_ma($xml, &$questions) {
         $choices = $thisquestion["#"]["ANSWER"];
         $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
 
-        for ($j = 0; $j < sizeof ($choices); $j++) {
+        for ($j = 0; $j < count ($choices); $j++) {
 
             $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
             // put this choice in the question object.
             $question->answer[$j] = $choice;
 
-            $correctanswercount = sizeof($correctanswers);
+            $correctanswercount = count($correctanswers);
             $id = $choices[$j]["@"]["id"];
             $iscorrect = 0;
             for ($k = 0; $k < $correctanswercount; $k++) {
@@ -275,7 +275,7 @@ function process_fib($xml, &$questions) {
         return;
     }
 
-    for ($i = 0; $i < sizeof ($fibquestions); $i++) {
+    for ($i = 0; $i < count ($fibquestions); $i++) {
         $question = $this->defaultquestion();
 
         $question->qtype = SHORTANSWER;
@@ -329,7 +329,7 @@ function process_matching($xml, &$questions) {
         return;
     }
 
-    for ($i = 0; $i < sizeof ($matchquestions); $i++) {
+    for ($i = 0; $i < count ($matchquestions); $i++) {
 
         $question = $this->defaultquestion();
 
@@ -349,7 +349,7 @@ function process_matching($xml, &$questions) {
         $question->name = shorten_text($question->questiontext, 254);
 
         $choices = $thisquestion["#"]["CHOICE"];
-        for ($j = 0; $j < sizeof ($choices); $j++) {
+        for ($j = 0; $j < count ($choices); $j++) {
 
             $subquestion = NULL;
 
@@ -359,14 +359,14 @@ function process_matching($xml, &$questions) {
             $question->subanswers[] = trim($choice);
 
             $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
-            for ($k = 0; $k < sizeof ($correctanswers); $k++) {
+            for ($k = 0; $k < count ($correctanswers); $k++) {
 
                 if (strcmp($choice_id, $correctanswers[$k]["@"]["choice_id"]) == 0) {
 
                     $answer_id = $correctanswers[$k]["@"]["answer_id"];
 
                     $answers = $thisquestion["#"]["ANSWER"];
-                    for ($m = 0; $m < sizeof ($answers); $m++) {
+                    for ($m = 0; $m < count ($answers); $m++) {
 
                         $answer = $answers[$m];
                         $current_ans_id = $answer["@"]["id"];
diff --git a/question/format/webct/format.php b/question/format/webct/format.php
index 81ae23a..754a65a 100644
--- a/question/format/webct/format.php
+++ b/question/format/webct/format.php
@@ -272,7 +272,7 @@ class qformat_webct extends qformat_default {
                         $warnings[] = get_string("missingquestion", "quiz", $nQuestionStartLine);
                         $QuestionOK = FALSE;
                     }
-                    if (sizeof($question->answer) < 1) {  // a question must have at least 1 answer
+                    if (count($question->answer) < 1) {  // a question must have at least 1 answer
                        $errors[] = get_string("missinganswer", "quiz", $nQuestionStartLine);
                        $QuestionOK = FALSE;
                     }
@@ -646,8 +646,8 @@ class qformat_webct extends qformat_default {
             }
         }
 
-        if (sizeof($errors) > 0) {
-            echo "<p>".get_string("errorsdetected", "quiz", sizeof($errors))."</p><ul>";
+        if (count($errors) > 0) {
+            echo "<p>".get_string("errorsdetected", "quiz", count($errors))."</p><ul>";
             foreach($errors as $error) {
                 echo "<li>$error</li>";
             }
@@ -655,8 +655,8 @@ class qformat_webct extends qformat_default {
             unset($questions);     // no questions imported
         }
 
-        if (sizeof($warnings) > 0) {
-            echo "<p>".get_string("warningsdetected", "quiz", sizeof($warnings))."</p><ul>";
+        if (count($warnings) > 0) {
+            echo "<p>".get_string("warningsdetected", "quiz", count($warnings))."</p><ul>";
             foreach($warnings as $warning) {
                 echo "<li>$warning</li>";
             }
diff --git a/question/type/calculatedsimple/edit_calculatedsimple_form.php b/question/type/calculatedsimple/edit_calculatedsimple_form.php
index 0275924..28098a8 100644
--- a/question/type/calculatedsimple/edit_calculatedsimple_form.php
+++ b/question/type/calculatedsimple/edit_calculatedsimple_form.php
@@ -168,7 +168,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                     $calcmax = optional_param('calcmax', '', PARAM_NUMBER);
                     $oldoptions  = optional_param('defoptions', '', PARAM_RAW);
                     $newdatasetvalues = false ;
-                    $sizeofolddef = sizeof($olddef);
+                    $sizeofolddef = count($olddef);
                     for($key = 1; $key <= $sizeofolddef; $key++) {
                         $def = $olddef[$key] ;
                         $this->datasetdefs[$def]= new stdClass ;
diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php
index ef0b1f0..eae2e94 100644
--- a/question/type/numerical/questiontype.php
+++ b/question/type/numerical/questiontype.php
@@ -1005,7 +1005,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
 
 
         // Apply any unit that is present.
-        if (ereg('^([+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][-+]?[0-9]+)?)([^0-9].*)?$',
+        if (preg_match('/^([+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][-+]?[0-9]+)?)([^0-9].*)?$/',
                 $rawresponse, $responseparts)) {
            //     echo"<p> responseparts <pre>";print_r($responseparts) ;echo"</pre></p>";
 
diff --git a/repository/s3/S3.php b/repository/s3/S3.php
index dadfb5a..de54aca 100644
--- a/repository/s3/S3.php
+++ b/repository/s3/S3.php
@@ -1116,7 +1116,7 @@ final class S3Request {
 	*/
 	public function getResponse() {
 		$query = '';
-		if (sizeof($this->parameters) > 0) {
+		if (count($this->parameters) > 0) {
 			$query = substr($this->uri, -1) !== '?' ? '?' : '&';
 			foreach ($this->parameters as $var => $value)
 				if ($value == null || $value == '') $query .= $var.'&';
@@ -1158,7 +1158,7 @@ final class S3Request {
 			if (strlen($value) > 0) $amz[] = strToLower($header).':'.$value;
 
 		// AMZ headers must be sorted
-		if (sizeof($amz) > 0) {
+		if (count($amz) > 0) {
 			sort($amz);
 			$amz = "\n".implode("\n", $amz);
 		} else $amz = '';
diff --git a/tag/lib.php b/tag/lib.php
index a28f1bd..01bcab3 100644
--- a/tag/lib.php
+++ b/tag/lib.php
@@ -892,7 +892,7 @@ function tag_process_computed_correlation(stdClass $tagcorrelation) {
     // The row tagid doesn't match the current tag id which means we are onto
     // the next tag. Before we switch over we need to either insert or update
     // the correlation.
-    $tagcorrelation->correlatedtags = join(',', $tagcorrelation->correlatedtags);
+    $tagcorrelation->correlatedtags = implode(',', $tagcorrelation->correlatedtags);
     if (!empty($tagcorrelation->id)) {
         // The tag correlation already exists so update it
         $DB->update_record('tag_correlation', $tagcorrelation);
diff --git a/tag/locallib.php b/tag/locallib.php
index 74c788e..c9f440d 100644
--- a/tag/locallib.php
+++ b/tag/locallib.php
@@ -228,7 +228,7 @@ function tag_print_search_results($query,  $page, $perpage, $return=false) {
 
     $query = array_shift(tag_normalize($query, TAG_CASE_ORIGINAL));
 
-    $count = sizeof(tag_find_tags($query, false));
+    $count = count(tag_find_tags($query, false));
     $tags = array();
 
     if ( $found_tags = tag_find_tags($query, true,  $page * $perpage, $perpage) ) {
@@ -254,7 +254,7 @@ function tag_print_search_results($query,  $page, $perpage, $return=false) {
         }
 
         $nr_of_lis_per_ul = 6;
-        $nr_of_uls = ceil( sizeof($tags) / $nr_of_lis_per_ul );
+        $nr_of_uls = ceil( count($tags) / $nr_of_lis_per_ul );
 
         $output .= '<ul id="tag-search-results">';
         for($i = 0; $i < $nr_of_uls; $i++) {
diff --git a/theme/index.php b/theme/index.php
index 9bd70a8..cc15634 100644
--- a/theme/index.php
+++ b/theme/index.php
@@ -141,7 +141,7 @@ foreach ($themes as $themename => $themedir) {
     $row[] = $infocell;
 
     $table->data[$themename] = $row;
-    $table->rowclasses[$themename] = join(' ', $rowclasses);
+    $table->rowclasses[$themename] = implode(' ', $rowclasses);
 }
 
 echo html_writer::table($table);
diff --git a/theme/yui_combo.php b/theme/yui_combo.php
index 464638a..215e349 100644
--- a/theme/yui_combo.php
+++ b/theme/yui_combo.php
@@ -77,7 +77,7 @@ foreach ($parts as $part) {
             $bits[] = 'skins';
             $bits[] = 'sam';
         }
-        $contentfile = $dir.'/yui/'.join('/', $bits).'/'.$filename;
+        $contentfile = $dir.'/yui/'.implode('/', $bits).'/'.$filename;
     } else {
         if ($version != $CFG->yui3version and $version != $CFG->yui2version and $version != 'gallery') {
             $content .= "\n// Wrong yui version $part!\n";
diff --git a/theme/yui_image.php b/theme/yui_image.php
index 23ac987..8ab08cd 100644
--- a/theme/yui_image.php
+++ b/theme/yui_image.php
@@ -40,7 +40,7 @@ if ($version == 'moodle' && count($parts) >= 3) {
     $frankenstyle = array_shift($parts);
     $module = array_shift($parts);
     $image = array_pop($parts);
-    $subdir = join('/', $parts);
+    $subdir = implode('/', $parts);
     $dir = get_component_directory($frankenstyle);
     $imagepath = $dir.'/yui/'.$module.'/assets/skins/sam/'.$image;
 } else if ($version == 'gallery' && count($parts)==3) {
